/* gozone - PowerDNS Admin Interface Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #334155;
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 52px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #fbbf24;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --sidebar-bg: #0b1322;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Sidebar layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--sidebar-hover);
    min-height: 56px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.sidebar-toggle:hover {
    color: #f1f5f9;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand a {
    color: var(--primary);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.2;
}

.sidebar-brand .nav-subtitle {
    font-size: 0.65rem;
    color: var(--sidebar-text);
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    padding-left: calc(0.75rem + 28px + 0.5rem);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.nav-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}

.nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #f1f5f9;
}

.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: #f1f5f9;
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 0.75rem;
    padding-left: calc(0.75rem + 28px + 0.5rem);
    border-top: 1px solid var(--sidebar-hover);
    font-size: 0.8rem;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-footer .username {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer .btn-logout {
    font-size: 0.75rem;
    color: var(--danger) !important;
    text-decoration: none;
    flex-shrink: 0;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background: var(--bg);
    transition: margin-left 0.25s ease;
}

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-header {
    padding: 0.5rem;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-brand {
    display: none;
}

body.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.6rem 0.5rem;
    gap: 0;
}

body.sidebar-collapsed .nav-icon {
    font-size: 1rem;
}

body.sidebar-collapsed .nav-text {
    display: none;
}

body.sidebar-collapsed .sidebar-nav a:hover::after {
    content: attr(title);
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    background: var(--sidebar-bg);
    color: #f1f5f9;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 300;
    box-shadow: var(--shadow);
}

body.sidebar-collapsed .sidebar-footer {
    padding: 0.5rem;
    justify-content: center;
    padding-left: 0.5rem;
}

body.sidebar-collapsed .sidebar-footer .username {
    display: none;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--text);
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg);
}

.theme-toggle-fixed {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 200;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.breadcrumb {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.breadcrumb:hover {
    text-decoration: underline;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #334155;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
}

.table tr:hover {
    background: #f8fafc;
}

[data-theme="dark"] .table tr:hover {
    background: #1a2332;
}

.table a {
    color: var(--primary);
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    background: var(--bg);
    color: var(--text-muted);
}

.badge-active {
    background: #dcfce7;
    color: var(--success);
}

.badge-disabled {
    background: #fee2e2;
    color: var(--danger);
}

.badge-admin {
    background: #dbeafe;
    color: var(--primary);
}

.badge-user {
    background: var(--bg);
    color: var(--text-muted);
}

.badge-type {
    background: #ede9fe;
    color: #7c3aed;
}

.badge-create_zone,
.badge-create_record {
    background: #dcfce7;
    color: var(--success);
}

.badge-delete_zone,
.badge-delete_record {
    background: #fee2e2;
    color: var(--danger);
}

.badge-login,
.badge-logout {
    background: var(--bg);
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2.5rem;
}

.login-box h1 {
    text-align: center;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* Zone Meta */
.zone-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

/* Actions Row */
.actions-row {
    display: flex;
    gap: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Profile */
.profile-info p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Server Info */
.server-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.server-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.server-info-label {
    font-weight: 600;
    min-width: 6rem;
    color: var(--text-muted);
}

/* API Keys */
.api-key-reveal {
    margin-top: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.api-key-reveal pre {
    flex: 1;
    background: #1e293b;
    color: #a5f3fc;
    padding: 0.75rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.5;
    margin: 0;
}

.api-key-reveal pre code {
    word-break: break-all;
    white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 768px) {
    body:not(.sidebar-collapsed) .sidebar {
        width: var(--sidebar-width);
        box-shadow: 4px 0 12px rgba(0,0,0,0.2);
    }

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .container {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}
