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

html, body {
    height: 100%;
}

body.admin-body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #111827 0, #020617 45%, #000000 100%);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
}

.admin-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
    padding: 24px 24px 28px;
    color: #e5e7eb;
}

.admin-card-small {
    width: 100%;
    max-width: 380px;
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f9fafb;
    margin-bottom: 4px;
}

.admin-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 20px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-label {
    font-size: 0.8rem;
    color: #9ca3af;
}

.admin-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.admin-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
    background-color: rgba(15, 23, 42, 1);
}

.admin-button {
    border-radius: 999px;
    padding: 10px 16px;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.admin-button-primary {
    background: linear-gradient(135deg, #22c55e, #22d3ee);
    color: #020617;
    box-shadow: 0 14px 30px rgba(34, 197, 94, 0.45);
    width: 100%;
}

.admin-form .admin-button-primary {
    margin-top: 8px;
}

.admin-button-secondary {
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.admin-button-ghost {
    background: transparent;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.admin-button-ghost:hover {
    background: rgba(148, 163, 184, 0.1);
    color: #f9fafb;
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.5);
    transform: translateY(-1px);
}

.admin-button-small {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.admin-button-success {
    background: rgba(22, 163, 74, 0.9);
    color: #ecfdf5;
}

.admin-button-warning {
    background: rgba(234, 179, 8, 0.9);
    color: #0f172a;
}

.admin-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.9);
}

.admin-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.admin-alert {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.admin-alert-success {
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.7);
    color: #bbf7d0;
}

.admin-alert-danger {
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.7);
    color: #fecaca;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    background: rgba(15, 23, 42, 0.96);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.admin-logo {
    font-weight: 600;
    color: #f9fafb;
}

.admin-header-tag {
    font-size: 0.75rem;
    color: #9ca3af;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 3px 10px;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-main {
    padding: 20px;
}

.admin-section {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-section-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
}

.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-input-inline {
    min-width: 180px;
    width: auto;
    flex: 1;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.admin-card-full {
    width: 100%;
}

.admin-card-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #f9fafb;
}

.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.admin-table th,
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

.admin-table tbody tr:hover {
    background-color: rgba(15, 23, 42, 0.9);
}

.admin-table-empty {
    text-align: center;
    color: #6b7280;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
}

.admin-badge-success {
    background: rgba(22, 163, 74, 0.15);
    color: #bbf7d0;
    border: 1px solid rgba(22, 163, 74, 0.7);
}

.admin-badge-danger {
    background: rgba(220, 38, 38, 0.15);
    color: #fecaca;
    border: 1px solid rgba(220, 38, 38, 0.7);
}

.admin-badge-pending {
    background: rgba(234, 179, 8, 0.15);
    color: #fef9c3;
    border: 1px solid rgba(234, 179, 8, 0.7);
}

.admin-table-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.admin-inline-form {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
    align-items: center;
}

.admin-inline-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-icon-toggle {
    padding: 6px 8px;
    border-radius: 999px;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
}

.admin-hamburger {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
}

.admin-hamburger span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background-color: #e5e7eb;
}

.admin-button-text {
    margin-top: 4px;
    align-self: flex-start;
    padding: 0;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 0.75rem;
    box-shadow: none;
}

.admin-button-text:hover {
    color: #e5e7eb;
    transform: none;
}

.admin-button-text:active {
    transform: none;
}

.admin-input-date {
    width: 150px;
    padding: 6px 8px;
    font-size: 0.75rem;
}

.admin-pagination {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.75rem;
}

.admin-page-link {
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #e5e7eb;
    text-decoration: none;
    background: rgba(15, 23, 42, 0.9);
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.admin-page-link:hover {
    background: rgba(30, 64, 175, 0.8);
    transform: translateY(-1px);
}

.admin-page-link-active {
    background: linear-gradient(135deg, #22c55e, #22d3ee);
    color: #020617;
    border-color: transparent;
}

@media (max-width: 900px) {
    .admin-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-section-header {
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .admin-main {
        padding: 14px;
    }

    .admin-header {
        padding: 10px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .admin-container {
        padding: 16px;
    }

    .admin-card {
        padding: 20px 18px 22px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 6px 8px;
    }
}

    /* Modal Styles */
.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.admin-modal-overlay.active {
    display: flex;
}

.admin-modal {
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f9fafb;
}

.admin-modal-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.admin-modal-close:hover {
    color: #e5e7eb;
}

/* Stats Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(148, 163, 184, 0.3);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #f9fafb;
    margin-bottom: 4px;
}

.stat-desc {
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend-up {
    color: #4ade80;
}

.stat-trend-down {
    color: #f87171;
}

.stat-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    margin-top: 16px;
    overflow: hidden;
}

.stat-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
}

/* Card Variations */
.stat-card-primary .stat-icon {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

.stat-card-success .stat-icon {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.stat-card-warning .stat-icon {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.stat-card-danger .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-card-info .stat-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stats-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f9fafb;
    margin: 32px 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
[data-tooltip] {
    position: relative;
    cursor: help;
}

/* Allow buttons to have pointer cursor instead of help */
button[data-tooltip],
a[data-tooltip] {
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0); /* Start slightly lower */
    background: rgba(15, 23, 42, 0.98);
    color: #f3f4f6;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.98) transparent transparent transparent;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s;
    margin-bottom: -2px; /* Connects arrow to tooltip */
    pointer-events: none;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px); /* Lift up effect */
    transition-delay: 0.1s; /* Slight delay to prevent accidental triggers */
}

/* Tooltip Position: Bottom */
[data-tooltip-pos="bottom"]::before {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 10px;
}

[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: -2px;
    border-color: transparent transparent rgba(15, 23, 42, 0.98) transparent;
}

[data-tooltip-pos="bottom"]:hover::before,
[data-tooltip-pos="bottom"]:hover::after {
    transform: translateX(-50%) translateY(4px); /* Drop down effect */
}
