/* Reset & base */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background-color: #f1f5f9;
    color: #333;
}

a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Collapsible */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1e3a5f 0%, #2d5a87 100%);
    padding: 15px;
    min-height: 100vh;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .logo h2,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .env-badge {
    display: none;
}

.sidebar.collapsed .menu a {
    justify-content: center;
    padding: 12px;
}

.sidebar .logo {
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 15px;
    text-align: center;
}

.sidebar .logo h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
    font-weight: 700;
}

.sidebar .env-badge {
    font-size: 11px;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.sidebar .env-badge.test { background: #ffc107; color: #212529; }
.sidebar .env-badge.prod { background: #28a745; color: #fff; }

.sidebar-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 14px;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu li { margin-bottom: 4px; }

.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    font-size: 13px;
    transition: .2s;
}

.menu a:hover, .menu a.active {
    background-color: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
}

.menu a.active {
    background-color: #007bff;
}

.menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Main content */
.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-x: auto;
}

/* Login form */
.login-container {
    display: flex;
    justify-content: center;
    padding-top: 50px;
}

.zonelogin {
    padding: 2rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    width: 100%;
    max-width: 400px;
}

.zonelogin form { display: flex; flex-direction: column; gap: 1rem; }
.zonelogin label { font-weight: 600; margin-bottom: .25rem; display: block; }
.zonelogin input[type="text"],
.zonelogin input[type="password"],
.zonelogin input[type="email"],
.zonelogin input[type="number"],
.zonelogin input[type="date"],
.zonelogin select,
.zonelogin textarea {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.zonelogin .select2-container {
    width: 100% !important;
}

/* Select2 beautify */
.select2-container .select2-selection--single {
    height: 40px;
    min-height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single {
    padding: 5px 5px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    padding: 0;
    color: #333;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 8px;
}

.select2-container--default .select2-dropdown {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    overflow: hidden;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    outline: none;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #2563eb;
    color: #fff;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e0f2fe;
    color: #0f172a;
}

.zonelogin button,
button.btn {
    padding: .7rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.zonelogin button,
.btn-primary {
    background-color: #007bff;
    color: #fff;
}

.zonelogin button:hover,
.btn-primary:hover { background-color: #0056b3; }

.btn-success { background-color: #28a745; color: #fff; }
.btn-success:hover { background-color: #1e7e34; }

.btn-info { background-color: #17a2b8; color: #fff; }
.btn-info:hover { background-color: #138496; }

.btn-warning { background-color: #ffc107; color: #212529; }
.btn-warning:hover { background-color: #d39e00; }

.btn-danger { background-color: #dc3545; color: #fff; }
.btn-danger:hover { background-color: #bd2130; }

.btn-sm { padding: .35rem .7rem; font-size: .85rem; }

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error { background-color: #f8d7da; color: #721c24; }
.alert-success { background-color: #d4edda; color: #155724; }
.alert-info { background-color: #cce5ff; color: #004085; }

/* Table */
.table-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    font-size: 13px;
}

table th, table td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

table tbody tr:hover { background-color: #f5f8ff; }

/* Compact columns */
table td.col-domain {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table td.col-owner {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table td.col-email {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header / toolbar */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header h3 { margin: 0; }

.search-bar input {
    padding: .55rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 280px;
}

/* Form layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.form-group { display: flex; flex-direction: column; }
.form-group label { font-weight: 600; margin-bottom: .35rem; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: .6rem .85rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: .95rem;
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

/* Checkbox styled */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.checkbox-inline input[type="checkbox"] { width: 18px; height: 18px; }

/* Push status badge */
.badge {
    display: inline-block;
    padding: .25rem .55rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-success { background-color: #d4edda; color: #155724; }
.badge-warning { background-color: #fff3cd; color: #856404; }
.badge-danger { background-color: #f8d7da; color: #721c24; }
.badge-secondary { background-color: #e2e3e5; color: #383d41; }

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.show { display: flex; }

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #ddd;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { width: 60px; }
    .sidebar .logo h2,
    .sidebar .menu-text,
    .sidebar .env-badge { display: none; }
    .sidebar .menu a { justify-content: center; padding: 12px; }
}

@media (max-width: 768px) {
    .dashboard-container { flex-direction: column; }
    .sidebar {
        width: 100%;
        min-height: auto;
        padding: 10px;
    }
    .sidebar .logo h2,
    .sidebar .menu-text,
    .sidebar .env-badge { display: block; }
    .sidebar .menu ul {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .sidebar .menu a {
        padding: 8px 12px;
        font-size: 12px;
    }
    .search-bar input { width: 100%; }
    .page-header { flex-direction: column; align-items: stretch; }
    .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .action-buttons .btn { font-size: 12px; padding: 6px 10px; }
}
