/* ========================================
   ADMIN STYLES - Dark Theme Only
   Combined from common.css + styles.css
   ======================================== */

html {
    overflow-y: auto !important;
}

:root {
    --theme-font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    --theme-heading-font-family: 'Playfair Display', serif;
    --theme-body-bg: #fff;
    --theme-text: #232733;
    --theme-container-bg: #44474e;
    --theme-container-shadow: rgba(0,0,0,0.10);
    --theme-header-bg-start: #232733;
    --theme-header-bg-end: #2a2d37;
    --theme-header-text: #ffffff;
    --theme-muted-text: #a0aec0;
    --theme-body-text-secondary: #cbd5e0;
    --theme-heading-color: #176a2a;
    --theme-cell-bg: #000;
    --theme-cell-border: #222;
    --theme-cell-text: #fff;
    --theme-cell-icon-bg: #e8f5e9;
    --theme-cell-icon-color: #ffffff;
    --theme-cell-icon-hover: #00bfff;
    --theme-button-grad-start: #63b3ed;
    --theme-button-grad-end: #4da6d6;
    --theme-button-grad-hover-start: #4da6d6;
    --theme-button-grad-hover-end: #3d96c0;
    --theme-button-shadow: rgba(99, 179, 237, 0.3);
    --theme-overlay-bg: rgba(10, 12, 16, 0.92);
    --theme-overlay-close-bg: #ff4d4f;
    --theme-modal-bg: #232733;
    --theme-modal-text: #e0e6ed;
    --theme-modal-border: #4a5568;
    --theme-modal-panel-bg: #1a202c;
    --theme-modal-panel-border: #4a5568;
    --theme-modal-placeholder: #2d3748;
    --theme-modal-button-bg: #4a5568;
    --theme-modal-button-hover: #63b3ed;
    --theme-accent: #4CAF50;
    --theme-accent-hover: #45a049;
    --theme-accent-text: #ffffff;
    --theme-footer-bg: #2d3139;
    --theme-footer-text: #a0aec0;
    --theme-surname-size: 16px;
    --theme-forename-size: 14px;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    background: #fff;
    color: #232733;
    overflow-y: auto !important;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ========================================
   DATA VIEWER & ADMIN TABLE/STATS STYLES
   ======================================== */

.stats {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
    padding: 20px;
    background: #2d3139;
    border-radius: 8px;
    border-left: 4px solid #63b3ed;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: #cbd5e0;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
    background: #44474e;
    border-radius: 4px;
    padding: 4px 12px;
    display: inline-block;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    margin-bottom: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #2d3139;
}

.data-table thead {
    background: #232733;
    border-bottom: 2px solid #1e2227;
}

.data-table th {
    padding: 16px 12px;
    text-align: left;
    color: #cbd5e0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #1e2227;
    color: #fff;
    font-size: 14px;
}

.data-table tbody tr {
    transition: background 0.2s ease;
    background: #2d3139;
}

.data-table tbody tr:hover {
    background: #383d47;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #cbd5e0;
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
    margin: 10px 0;
}

/* ========================================
   PANEL HEADER & BUTTON BAR
   ======================================== */

.panel-header {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    background: #2d3139;
    padding: 18px 24px 18px 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
}

.admin-button-bar {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #ff4d4f;
    color: #fff;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(255, 77, 79, 0.35);
    padding: 0;
}

.admin-close-btn:hover {
    background: #ff7875;
}

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.container {
    max-width: 900px;
    margin: 40px auto;
    background: #44474e;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.container.wide {
    max-width: 1200px;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    color: #fff;
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.header p {
    color: #a0aec0;
    font-size: 14px;
}

/* ========================================
   SECTIONS
   ======================================== */

.admin-section,
.form-section {
    background: #2d3139;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.admin-section h2,
.form-section h2 {
    color: #63b3ed;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid #63b3ed;
    padding-bottom: 10px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    color: #cbd5e0;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
}

.required::after {
    content: " *";
    color: #ff4d4f;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #1e2227;
    border-radius: 6px;
    background: #1e2227;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    cursor: pointer;
}

select option {
    background: #1e2227;
    color: #fff;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #63b3ed;
}

input::placeholder,
textarea::placeholder {
    color: #718096;
}

/* ========================================
   PASSWORD FIELD
   ======================================== */

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    flex: 1;
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: #63b3ed;
}

/* ========================================
   FORM LAYOUT
   ======================================== */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row.full {
    grid-template-columns: 1fr;
}

.form-row.three {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row.half {
    grid-template-columns: 1fr 1fr;
}

/* ========================================
   BUTTONS
   ======================================== */

button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #63b3ed 0%, #4da6d6 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(99, 179, 237, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    width: 100%;
    position: relative;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4da6d6 0%, #3d96c0 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(99, 179, 237, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(99, 179, 237, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background: #718096;
    color: #fff;
    padding: 10px 20px;
    box-shadow: 0 6px 15px rgba(113, 128, 150, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn-secondary:hover {
    background: #a0aec0;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(113, 128, 150, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(113, 128, 150, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-success {
    background: #4caf50;
    color: #fff;
    padding: 10px 20px;
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.btn-success:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    box-shadow: 0 6px 15px rgba(255, 77, 79, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn-danger:hover {
    background: #ff7875;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 77, 79, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.btn-danger:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Shorthand button classes */
.secondary {
    background: #718096;
    color: #fff;
    padding: 10px 20px;
    box-shadow: 0 6px 15px rgba(113, 128, 150, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.secondary:hover {
    background: #a0aec0;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(113, 128, 150, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.danger {
    background: #ff4d4f;
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    box-shadow: 0 6px 15px rgba(255, 77, 79, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.danger:hover {
    background: #ff7875;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 77, 79, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.button-group {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.button-group .btn-secondary {
    width: 100%;
}

/* ========================================
   TABLES
   ======================================== */

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.users-table thead {
    background: #1e2227;
}

.users-table th {
    padding: 12px;
    text-align: left;
    color: #63b3ed;
    font-weight: 600;
    border-bottom: 2px solid #63b3ed;
}

.users-table td {
    padding: 12px;
    color: #cbd5e0;
    border-bottom: 1px solid #3d4249;
}

.users-table tr:hover {
    background: #383d47;
}

.actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   MESSAGES
   ======================================== */

.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-size: 15px;
    font-weight: 500;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 5px solid #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 5px solid #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.message.show {
    display: block;
}

/* ========================================
   LINKS & NAVIGATION
   ======================================== */

.back-link {
    color: #63b3ed;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    display: inline-block;
}

.back-link:hover {
    text-decoration: underline;
}

.nav-buttons {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    background: linear-gradient(135deg, #63b3ed 0%, #4da6d6 100%);
    padding: 10px 20px;
    border-radius: 6px;
    display: inline-block;
}

.nav-link:hover {
    background: linear-gradient(135deg, #4da6d6 0%, #3d96c0 100%);
}

/* ========================================
   INFO & PREVIEW BOXES
   ======================================== */

.info-box,
.preview {
    background: #1e2227;
    padding: 15px;
    border-left: 4px solid #63b3ed;
    margin-bottom: 20px;
    border-radius: 4px;
    color: #a0aec0;
    font-size: 13px;
}

.preview {
    display: none;
}

.preview.show,
.cell-preview.show {
    display: block;
}

.preview h4,
.cell-preview h4 {
    color: #63b3ed;
    margin-bottom: 10px;
}

.preview p,
.cell-preview p {
    margin: 5px 0;
}

.cell-preview {
    background: #1e2227;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    color: #cbd5e0;
    font-size: 13px;
    display: none;
}

/* ========================================
   UTILITIES
   ======================================== */

.loading {
    text-align: center;
    color: #a0aec0;
    padding: 20px;
}

.edit-mode {
    display: none;
}

.edit-mode.show {
    display: block;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.modal-content {
    background: #44474e;
    border-radius: 12px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.4);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #63b3ed;
    background: #2d3139;
}

.modal-header h2 {
    color: #63b3ed;
    margin: 0;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #ff7875;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

.modal-body .users-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

/* ========================================
   PAGE OVERLAY & CELL STYLES (from common.css)
   ======================================== */

html.overlay-open,
body.overlay-open {
    overflow: hidden !important;
}

body.in-iframe {
    overflow: hidden !important;
}

html.in-iframe {
    overflow: hidden !important;
}

.page-overlay {
    position: fixed;
    inset: 0;
    background: var(--theme-overlay-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    z-index: 2000;
    overflow: hidden;
    will-change: opacity;
    transform: translateZ(0);
    visibility: hidden;
}

.page-overlay.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.page-overlay iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--theme-body-bg);
    display: block;
    overflow: hidden;
}

.page-overlay iframe::-webkit-scrollbar {
    display: none;
}

.overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--theme-overlay-close-bg);
    color: var(--theme-accent-text);
    font-size: 22px;
    line-height: 36px;
    cursor: pointer;
    z-index: 2001;
    opacity: 0;
    pointer-events: none;
}

.cell .names {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    margin-bottom: 2px;
}

.cell .name-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.cell .surname {
    font-weight: 700;
    color: var(--theme-cell-text);
    font-size: var(--theme-surname-size);
    word-break: break-word;
}

.cell .forename,
.cell .middlename {
    color: var(--theme-cell-text);
    font-size: var(--theme-forename-size);
    word-break: break-word;
}

/* ========================================
   DETAIL POPUP THEMING OVERRIDES
   ======================================== */

.detail-content {
    color: var(--theme-modal-text) !important;
    padding: 12px !important;
    padding-top: 35px !important;
}

.cell-number-badge {
    background: var(--theme-button-grad-start) !important;
    color: var(--theme-accent-text) !important;
}

.detail-header h2 {
    color: var(--theme-modal-text) !important;
    border-bottom: 2px solid var(--theme-modal-border) !important;
    margin: 0 0 12px 0 !important;
    padding-bottom: 6px !important;
    font-size: 18px !important;
}

.detail-section h3,
.detail-links h3 {
    color: var(--theme-muted-text) !important;
}

.detail-section {
    margin-bottom: 12px !important;
    gap: 8px !important;
}

.detail-field {
    background: rgba(255,255,255,0.05) !important;
    padding: 6px !important;
    margin-bottom: 0 !important;
}

.detail-field label {
    color: var(--theme-body-text-secondary) !important;
    text-align: left !important;
    font-size: 12px !important;
    margin-bottom: 2px !important;
}

.detail-field span {
    color: var(--theme-modal-text) !important;
    text-align: center !important;
    font-size: 13px !important;
}

.detail-links {
    border-top: 2px solid var(--theme-modal-border) !important;
    margin-top: 12px !important;
    padding-top: 12px !important;
}

.detail-links h3 {
    margin: 0 0 10px 0 !important;
    font-size: 14px !important;
}

.link-icons {
    gap: 12px !important;
}

.detail-icon {
    background: rgba(255,255,255,0.1) !important;
}

.detail-icon:hover {
    background: rgba(255,255,255,0.2) !important;
}

.detail-icon[data-title] {
    position: relative;
}

.detail-icon[data-title]:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 50%;
    top: 110%;
    transform: translateX(-50%);
    background: rgba(100, 100, 100, 0.15) !important;
    color: #ffffff !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px !important;
    font-family: Roboto, sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    white-space: nowrap;
    z-index: 10000;
    text-decoration: none !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes haloEffect {
    0%, 20% {
        box-shadow: 0 0 30px 15px rgba(76, 175, 80, 0.9);
    }
    50% {
        box-shadow: 0 0 40px 20px rgba(76, 175, 80, 0.7);
    }
    80% {
        box-shadow: 0 0 30px 15px rgba(76, 175, 80, 0.5);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.cell.highlight-target {
    animation: haloEffect 5s ease-in-out;
    position: relative;
    z-index: 100;
}
