/* CNP Admin Dashboard - GOD-TIER Premium Styles */

/* =========================================
   CSS VARIABLES
   ========================================= */
:root {
    --black: #0a0a0a;
    --black-light: #121212;
    --black-medium: #1a1a1a;
    --gold: #f5c518;
    --gold-dark: #d4a516;
    --gold-glow: rgba(245, 197, 24, 0.4);
    --white: #ffffff;
    --white-muted: rgba(255, 255, 255, 0.7);
    --white-dim: rgba(255, 255, 255, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.3);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.3);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.3);
    --info: #3b82f6;
    --info-glow: rgba(59, 130, 246, 0.3);
    --gradient-gold: linear-gradient(135deg, #f5c518 0%, #ffd700 50%, #d4a516 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    --shadow-gold: 0 10px 40px -10px rgba(245, 197, 24, 0.3);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* =========================================
   RESET & BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--black);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(245, 197, 24, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(59, 130, 246, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* =========================================
   LAYOUT
   ========================================= */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR - Premium Glass Design
   ========================================= */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(18, 18, 18, 0.95) 0%, rgba(10, 10, 10, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 1.75rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.logout-link {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    justify-content: center;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(245, 197, 24, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.sidebar-logo:hover img {
    transform: scale(1.05) rotate(-3deg);
    box-shadow: var(--shadow-gold);
}

.sidebar-logo span {
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    color: var(--white-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-gold);
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-link:hover {
    background: var(--glass-bg-hover);
    color: var(--white);
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(245, 197, 24, 0.12) 0%, rgba(245, 197, 24, 0.05) 100%);
    color: var(--gold);
    border: 1px solid rgba(245, 197, 24, 0.2);
    box-shadow: 0 4px 20px rgba(245, 197, 24, 0.1);
}

.nav-link.active::before {
    opacity: 1;
}

.nav-icon {
    font-size: 1.35rem;
    width: 28px;
    text-align: center;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2.5rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.5s ease-out;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.page-subtitle {
    color: var(--white-muted);
    font-size: 0.95rem;
}

/* =========================================
   STATS GRID - Premium Cards
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out backwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.25s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-gold);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.stat-icon.gold {
    background: linear-gradient(135deg, rgba(245, 197, 24, 0.2), rgba(245, 197, 24, 0.05));
    box-shadow: 0 0 30px rgba(245, 197, 24, 0.15);
}

.stat-icon.green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.15);
}

.stat-icon.blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05));
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.15);
}

.stat-icon.orange {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.15);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--white-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--white-dim);
    font-weight: 500;
}

/* =========================================
   TABLE - Premium Design
   ========================================= */
.table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out 0.3s backwards;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.table-title {
    font-weight: 700;
    font-size: 1.1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1.25rem 1.75rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--white-dim);
}

tr {
    transition: all 0.2s;
}

tbody tr:hover {
    background: var(--glass-bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* =========================================
   BADGES - Glowing Pills
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.3s;
}

.badge-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.1);
}

.badge-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
}

.badge-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.badge-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

/* =========================================
   BUTTONS - Premium Interactions
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--black);
    box-shadow: 0 4px 20px rgba(245, 197, 24, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--white);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 10px;
}

/* =========================================
   FORMS - Elegant Inputs
   ========================================= */
.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--white-muted);
}

.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--white);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.1), 0 0 20px rgba(245, 197, 24, 0.1);
}

.form-input::placeholder {
    color: var(--white-dim);
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 3rem;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--white-dim);
    font-size: 1rem;
}

/* =========================================
   MODAL - Floating Glass Panel
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: linear-gradient(180deg, var(--black-light) 0%, var(--black) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.modal-close {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--white-muted);
    font-size: 1.25rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

/* =========================================
   LOGIN PAGE - Hero Design
   ========================================= */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background:
        radial-gradient(ellipse 100% 100% at 50% 0%, rgba(245, 197, 24, 0.08) 0%, transparent 50%),
        var(--black);
}

.login-card {
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.9) 0%, rgba(10, 10, 10, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

.login-logo {
    width: 100px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 8px 24px rgba(245, 197, 24, 0.2));
    animation: float 3s ease-in-out infinite;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--white-muted);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.75rem;
}

.page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 1rem;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.page-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
}

.page-btn.active {
    background: var(--gradient-gold);
    color: var(--black);
    border-color: var(--gold);
    box-shadow: var(--shadow-gold);
}

/* =========================================
   LOADING & STATES
   ========================================= */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--white-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: var(--white);
}

.toast-error {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: var(--white);
}

/* =========================================
   CARD COMPONENT
   ========================================= */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.75rem;
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--glass-border-hover);
}

.card-title {
    font-size: 0.9rem;
    color: var(--white-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(245, 197, 24, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(245, 197, 24, 0.4);
    }
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    th,
    td {
        padding: 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 2rem;
        border-radius: 24px;
    }
}

/* =========================================
   UTILITY CLASSES
   ========================================= */
.hidden {
    display: none !important;
}

.text-gold {
    color: var(--gold);
}

.text-muted {
    color: var(--white-muted);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.glow-gold {
    animation: glow 2s ease-in-out infinite;
}