/**
 * style.css
 * ไฟล์สไตล์ชีตหลักสำหรับ SBBOTFLOW Admin Panel (Cyberpunk Red & Glassmorphism Theme)
 */

:root {
    --red-primary: #FF0A26;
    --red-dark: #C00419;
    --red-gradient: linear-gradient(135deg, #FF1A35 0%, #D9001D 50%, #990014 100%);
    --red-glow: rgba(255, 10, 38, 0.45);
    --silver-light: #F8FAFC;
    --silver-mid: #CBD5E1;
    --silver-dark: #64748B;
    --bg-dark: #050508;
    --bg-card: rgba(14, 14, 22, 0.92);
    --border-card: rgba(255, 10, 38, 0.35);
}

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

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 10, 38, 0.28) 0%, transparent 700px),
        radial-gradient(ellipse at 50% 100%, rgba(255, 10, 38, 0.18) 0%, transparent 550px),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.01) 0, rgba(255, 255, 255, 0.01) 2px, transparent 0, transparent 8px);
    background-attachment: fixed;
    color: var(--silver-light);
    padding: 24px;
    min-height: 100vh;
}

/* Ambient Glow Background Circles */
.ambient-glow {
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: var(--red-glow);
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}
.glow-top { top: -100px; left: 50%; transform: translateX(-50%); }
.glow-bottom { bottom: -100px; right: 10%; }

.container { 
    max-width: 1140px; 
    margin: 0 auto; 
    position: relative;
    z-index: 10;
}

/* Login Layout */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--border-card);
    border-radius: 24px;
    padding: 42px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 10, 38, 0.25);
    text-align: center;
    transition: all 0.3s ease;
}

.login-card:hover {
    border-color: rgba(255, 10, 38, 0.65);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 50px rgba(255, 10, 38, 0.4);
}

.logo-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.logo-img {
    width: 75px;
    height: 75px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px var(--red-glow));
    animation: logoFloat 3s ease-in-out infinite alternate;
}

@keyframes logoFloat {
    0% { transform: translateY(0); filter: drop-shadow(0 0 12px var(--red-glow)); }
    100% { transform: translateY(-6px); filter: drop-shadow(0 0 25px rgba(255, 10, 38, 0.8)); }
}

.logo-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.sign-text { color: #FFFFFF; text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.flow-text { color: var(--red-primary); text-shadow: 0 0 15px var(--red-glow); }

.admin-badge {
    background: rgba(255, 10, 38, 0.15);
    border: 1px solid rgba(255, 10, 38, 0.4);
    color: #FF4949;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 1px;
    display: inline-block;
    margin-top: 4px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--silver-dark);
    margin-bottom: 26px;
    font-weight: 500;
}

/* Top Bar Header */
header.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid var(--border-card);
    border-radius: 20px;
    padding: 16px 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 10, 38, 0.15);
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px var(--red-glow));
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #FFF;
    line-height: 1.2;
}

.brand-title span { color: var(--red-primary); }

.admin-sub {
    font-size: 0.72rem;
    color: var(--silver-dark);
    letter-spacing: 1px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.88rem;
}

.btn-logout {
    background: rgba(255, 73, 73, 0.12);
    border: 1px solid rgba(255, 73, 73, 0.4);
    color: #FF6B6B;
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: #FF1A35;
    color: #FFF;
    box-shadow: 0 0 15px rgba(255, 26, 53, 0.6);
}

/* Stats Overview Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(14, 14, 22, 0.9);
    backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat-card:hover { transform: translateY(-3px); }
.stat-card.total-card { border-color: rgba(255, 255, 255, 0.25); }
.stat-card.active-card { border-color: rgba(52, 211, 153, 0.45); }
.stat-card.month-card { border-color: rgba(56, 189, 248, 0.45); }
.stat-card.lifetime-card { border-color: rgba(251, 191, 36, 0.45); }

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--silver-mid); font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Form Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1.5px solid var(--border-card);
    border-radius: 22px;
    padding: 26px;
    margin-bottom: 24px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #FFF;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    align-items: end;
}

@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

label { 
    display: block; 
    margin-bottom: 8px; 
    font-size: 0.85rem; 
    color: var(--silver-mid); 
    font-weight: 600; 
}

input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 10, 38, 0.35);
    background: rgba(5, 5, 8, 0.9);
    color: #FFF;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
    border-color: var(--red-primary);
    box-shadow: 0 0 15px var(--red-glow);
}

.btn-submit, .btn-primary {
    width: 100%;
    padding: 13px 22px;
    border-radius: 12px;
    border: none;
    background: var(--red-gradient);
    color: #FFF;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--red-glow);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover, .btn-primary:hover {
    transform: scale(1.02);
    filter: brightness(1.2);
    box-shadow: 0 6px 25px rgba(255, 10, 38, 0.7);
}

.error-alert {
    background: rgba(255, 73, 73, 0.15);
    border: 1px solid #FF4949;
    color: #FF6B6B;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.default-info {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.78rem;
    color: #38BDF8;
    margin-top: 24px;
    line-height: 1.6;
}

.default-info code {
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    color: #FFF;
    font-family: monospace;
}

/* Success Key Box */
.key-created-box {
    background: rgba(52, 211, 153, 0.1);
    border: 1.5px solid #34D399;
    border-radius: 16px;
    padding: 20px 24px;
    color: #34D399;
    margin-bottom: 24px;
    line-height: 1.7;
}

.key-display-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.key-badge {
    background: #000;
    border: 1.5px dashed #FF1A35;
    padding: 10px 18px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.3rem;
    color: #FF4949;
    font-weight: 800;
    border-radius: 10px;
    letter-spacing: 1px;
    box-shadow: inset 0 0 10px rgba(255, 10, 38, 0.3);
}

.btn-copy {
    background: rgba(52, 211, 153, 0.2);
    border: 1px solid #34D399;
    color: #34D399;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover { background: #34D399; color: #000; }

/* Table & Search Header */
.table-header-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 14px;
}

.search-box {
    display: flex;
    gap: 8px;
    max-width: 380px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th {
    background: rgba(255, 10, 38, 0.12);
    color: #FF4949;
    font-weight: 700;
    white-space: nowrap;
}

tr:hover { background: rgba(255, 255, 255, 0.025); }

.badge { padding: 5px 12px; border-radius: 8px; font-size: 0.78rem; font-weight: 700; display: inline-block; }
.badge-1month { background: rgba(56,189,248,0.15); color: #38BDF8; border: 1px solid rgba(56,189,248,0.35); }
.badge-lifetime { background: rgba(251,191,36,0.15); color: #FBBF24; border: 1px solid rgba(251,191,36,0.35); }
.badge-active { background: rgba(52,211,153,0.15); color: #34D399; border: 1px solid rgba(52,211,153,0.35); }
.badge-suspended { background: rgba(239,68,68,0.15); color: #EF4444; border: 1px solid rgba(239,68,68,0.35); }
.badge-expired { background: rgba(148,163,184,0.15); color: #94A3B8; border: 1px solid rgba(148,163,184,0.35); }

.btn-action {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #FFF;
    padding: 5px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action.btn-edit { border-color: #38BDF8; color: #38BDF8; }
.btn-action.btn-edit:hover { background: #38BDF8; color: #000; box-shadow: 0 0 10px rgba(56, 189, 248, 0.5); }
.btn-action.btn-suspend { border-color: #EF4444; color: #EF4444; }
.btn-action.btn-suspend:hover { background: #EF4444; color: #FFF; box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
.btn-action.btn-activate { border-color: #34D399; color: #34D399; }
.btn-action.btn-activate:hover { background: #34D399; color: #000; box-shadow: 0 0 10px rgba(52, 211, 153, 0.5); }
.btn-action.btn-delete { border-color: #64748B; color: #94A3B8; }
.btn-action.btn-delete:hover { background: #64748B; color: #FFF; }

/* Edit License Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 8, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: rgba(18, 14, 22, 0.98);
    border: 2px solid var(--red-primary);
    box-shadow: 0 0 60px var(--red-glow);
    border-radius: 24px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: modalBounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalBounce {
    from { opacity: 0; transform: scale(0.88); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.modal-header-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #38BDF8;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--silver-dark);
    font-size: 1.2rem;
    cursor: pointer;
}
.btn-close-modal:hover { color: #FF4949; }

/* SweetAlert2 Cyberpunk Theme Overrides */
.swal2-popup {
    background: rgba(18, 14, 22, 0.98) !important;
    border: 2px solid var(--red-primary) !important;
    box-shadow: 0 0 60px var(--red-glow) !important;
    border-radius: 24px !important;
    color: var(--silver-light) !important;
    font-family: 'Prompt', sans-serif !important;
    padding: 24px !important;
}

.swal2-title {
    color: #FFFFFF !important;
    font-weight: 800 !important;
    font-size: 1.35rem !important;
}

.swal2-html-container {
    color: var(--silver-mid) !important;
    font-size: 0.95rem !important;
}

.swal2-confirm {
    background: var(--red-gradient) !important;
    color: #FFF !important;
    font-weight: 800 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px var(--red-glow) !important;
    padding: 10px 24px !important;
}

.swal2-cancel {
    background: rgba(100, 116, 139, 0.3) !important;
    border: 1px solid #64748B !important;
    color: #FFF !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    padding: 10px 20px !important;
}
