/* ============================================
   AngelWings — Premium Dark Theme Design System
   ============================================ */

/* --- CSS Reset & Root Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Core Palette */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2236;
    --bg-card: rgba(26, 34, 54, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    /* Accent Colors */
    --accent-gold: #F6C445;
    --accent-gold-light: #FADA7A;
    --accent-gold-dim: rgba(246, 196, 69, 0.15);
    --accent-blue: #3B82F6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-emerald: #10B981;
    --accent-emerald-dim: rgba(16, 185, 129, 0.15);
    --accent-rose: #F43F5E;
    --accent-rose-dim: rgba(244, 63, 94, 0.15);
    --accent-violet: #8B5CF6;
    --accent-violet-dim: rgba(139, 92, 246, 0.15);

    /* Text Colors */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: var(--accent-gold);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(246, 196, 69, 0.3);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow-gold: 0 0 40px rgba(246, 196, 69, 0.1);
    --shadow-glow-blue: 0 0 40px rgba(59, 130, 246, 0.1);

    /* Gradients */
    --gradient-gold: linear-gradient(135deg, #F6C445 0%, #E8A817 100%);
    --gradient-dark: linear-gradient(180deg, #0a0e1a 0%, #111827 100%);
    --gradient-card: linear-gradient(135deg, rgba(26, 34, 54, 0.8) 0%, rgba(17, 24, 39, 0.6) 100%);
    --gradient-shimmer: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

a {
    text-decoration: none;
    color: var(--accent-gold);
    transition: color var(--transition-fast);
}

a:hover { color: var(--accent-gold-light); }

img { max-width: 100%; height: auto; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(246, 196, 69, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -1%) rotate(1deg); }
    66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: var(--space-2xl);
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-gold);
    animation: slideUp 0.6s var(--transition-spring) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes slideUp {
    to { opacity: 1; transform: translateY(0); }
}

.login-brand {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.login-brand .brand-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-md);
    background: var(--gradient-gold);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 32px rgba(246, 196, 69, 0.3);
    color: white;
}
.login-brand .brand-icon svg {
    width: 44px;
    height: 44px;
}

.login-brand h1 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2.25rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
    margin-bottom: var(--space-lg);
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.938rem;
    transition: all var(--transition-base);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-gold);
    background: var(--bg-glass-hover);
    box-shadow: 0 0 0 3px var(--accent-gold-dim);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-icon {
    position: relative;
}

.form-control-icon .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color var(--transition-base);
}

.form-control-icon .form-control {
    padding-left: 42px;
}

.form-control-icon:focus-within .icon {
    color: var(--accent-gold);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394A3B8' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select.form-control option {
    background-color: #ffffff;
    color: #000000;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 1; }

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--gradient-gold);
    color: #1a1a1a;
    box-shadow: 0 4px 16px rgba(246, 196, 69, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(246, 196, 69, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-accent);
}

.btn-danger {
    background: var(--accent-rose);
    color: white;
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 24px rgba(244, 63, 94, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.btn-icon:hover {
    background: var(--bg-glass-hover);
    color: var(--accent-gold);
    border-color: var(--border-accent);
}

.btn-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ============================================
   ADMIN LAYOUT
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    will-change: transform;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
}

.sidebar-brand {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-brand .brand-mark {
    width: 44px;
    height: 44px;
    background: var(--gradient-gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(246, 196, 69, 0.3);
    color: white;
}
.sidebar-brand .brand-mark svg {
    width: 26px;
    height: 26px;
}

.sidebar-brand h2 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.35rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: var(--space-md) var(--space-md);
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.688rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-gold);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-svg-icon {
    transition: stroke var(--transition-base);
    stroke: var(--text-secondary);
}

.nav-item:hover .nav-svg-icon {
    stroke: var(--text-primary);
}

.nav-item.active .nav-svg-icon {
    stroke: var(--accent-gold);
}

.sidebar-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border-subtle);
}

.sidebar-footer .admin-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.sidebar-footer .admin-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-footer .admin-name {
    font-size: 0.813rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    padding: var(--space-xl) var(--space-2xl);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(17, 24, 39, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateZ(0);
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.content-header .header-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.content-body {
    padding: var(--space-2xl);
}

/* Mobile toggle */
.mobile-toggle {
    display: none;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.25rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    transition: all var(--transition-base);
    transform: translateZ(0);
    will-change: transform;
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2, .card-header h3 {
    font-size: 1.125rem;
}

.card-body {
    padding: var(--space-xl);
}

.card-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.1;
}

.stat-card.gold::after { background: var(--accent-gold); }
.stat-card.blue::after { background: var(--accent-blue); }
.stat-card.emerald::after { background: var(--accent-emerald); }

.stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.stat-card.gold .stat-value { color: var(--accent-gold); }
.stat-card.blue .stat-value { color: var(--accent-blue); }
.stat-card.emerald .stat-value { color: var(--accent-emerald); }

.stat-card .stat-label {
    font-size: 0.813rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   TABLE
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

thead th {
    padding: 14px var(--space-lg);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

tbody tr {
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}

tbody tr:hover {
    background: var(--bg-glass-hover);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 14px var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.table-actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   SEARCH BAR
   ============================================ */

.search-container {
    position: relative;
    max-width: 400px;
}

.search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-base);
}

.search-container input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    outline: none;
}

.search-container input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px var(--accent-gold-dim);
}

.search-container input:focus + .search-icon {
    color: var(--accent-gold);
}

.search-container .search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-full);
    display: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.search-container .search-clear:hover { color: var(--text-primary); }
.search-container.has-value .search-clear { display: block; }

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-gold { background: var(--accent-gold-dim); color: var(--accent-gold); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-emerald { background: var(--accent-emerald-dim); color: var(--accent-emerald); }
.badge-rose { background: var(--accent-rose-dim); color: var(--accent-rose); }
.badge-violet { background: var(--accent-violet-dim); color: var(--accent-violet); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 450px;
    pointer-events: all;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    animation: toastIn 0.4s var(--transition-spring) forwards;
    opacity: 0;
    transform: translateX(100%);
}

.toast.hiding {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(100%); }
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
}

.toast-error {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
}

.toast-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-blue);
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px;
    font-size: 1.1rem;
}

.toast-close:hover { opacity: 1; }

/* ============================================
   FILE UPLOAD
   ============================================ */

.file-upload {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-upload:hover, .file-upload.dragover {
    border-color: var(--accent-gold);
    background: var(--accent-gold-dim);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-upload .upload-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.file-upload .upload-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.file-upload .upload-text strong {
    color: var(--accent-gold);
}

/* State when file is loaded */
.file-upload.has-file {
    padding: 0;
    height: auto;
    min-height: 450px;
    border-style: solid;
    border-color: var(--accent-gold);
    background: #000;
}

.file-upload.has-file.is-pdf {
    height: 85vh;
    min-height: 600px;
}

.file-upload.has-file input[type="file"] {
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.file-upload-preview-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: none;
}

.file-upload.has-file .file-upload-preview-container {
    display: block;
}

.file-upload.has-file .upload-instructions {
    display: none;
}

.file-upload-preview-container img,
.file-upload-preview-container iframe {
    width: 100%;
    height: auto;
    min-height: 450px;
    object-fit: contain;
    border: none;
    display: block;
}

.file-upload.has-file.is-pdf .file-upload-preview-container iframe {
    height: 100%;
    min-height: 100%;
}

.file-upload-preview {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    display: none;
    align-items: center;
    gap: var(--space-md);
    border: 1px solid var(--border-subtle);
}

.file-upload-preview.active {
    display: flex;
}

/* ============================================
   CERTIFICATE VIEW
   ============================================ */

.cert-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
}

.cert-info-list {
    list-style: none;
}

.cert-info-list li {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cert-info-list li:last-child { border-bottom: none; }

.cert-info-list .info-label {
    font-size: 0.813rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.cert-info-list .info-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.cert-preview {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
}

.cert-preview img {
    width: 100%;
    display: block;
}

.cert-preview iframe {
    width: 100%;
    height: 500px;
    border: none;
}

/* QR Code Section */
.qr-section {
    text-align: center;
    padding: var(--space-xl);
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.qr-section .qr-code {
    display: inline-block;
    background: white;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

.qr-section .qr-code img,
.qr-section .qr-code canvas {
    width: 200px;
    height: 200px;
    display: block;
}

.qr-section .qr-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-top: var(--space-sm);
}

.qr-download-options {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

/* ============================================
   PUBLIC VERIFY PAGE
   ============================================ */

.verify-page {
    min-height: 100vh;
    background: var(--gradient-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    position: relative;
}

.verify-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(246, 196, 69, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.verify-card {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    overflow: hidden;
    animation: slideUp 0.6s var(--transition-spring) forwards;
    opacity: 0;
    transform: translateY(30px);
}

.verify-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.verify-header .verify-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-emerald-dim);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent-emerald);
    font-size: 0.75rem;
    font-weight: 600;
}

.verify-body {
    padding: var(--space-xl);
}

.view-btn {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.view-btn.active {
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.15); /* Accent gold with opacity */
}

.cert-preview img, .cert-preview iframe {
    max-width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.cert-preview:fullscreen {
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}
.cert-preview:fullscreen img {
    max-height: 100%;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}
.cert-preview:fullscreen iframe {
    height: 100%;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
}
.cert-preview:-webkit-full-screen {
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}
.cert-preview:-webkit-full-screen img {
    max-height: 100%;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}
.cert-preview:-webkit-full-screen iframe {
    height: 100%;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
}

.verify-body .cert-image {
    width: 100%;
    border-radius: var(--radius-md);
    display: block;
}

.verify-body iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: var(--radius-md);
}

.verify-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.verify-footer .branding {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.813rem;
    color: var(--text-muted);
}

.verify-footer .branding .mark {
    width: 24px;
    height: 24px;
    background: var(--gradient-gold);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.verify-not-found {
    text-align: center;
    padding: var(--space-3xl);
}

.verify-not-found .error-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.verify-not-found h2 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.verify-not-found p {
    color: var(--text-secondary);
}

/* ============================================
   CUSTOM FIELDS MANAGEMENT
   ============================================ */

.field-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.field-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.field-item:hover {
    border-color: var(--border-light);
    background: var(--bg-glass-hover);
}

.field-item .field-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-violet-dim);
    color: var(--accent-violet);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.field-item .field-details {
    flex: 1;
}

.field-item .field-label {
    font-weight: 500;
    font-size: 0.875rem;
}

.field-item .field-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   SETTINGS PAGE
   ============================================ */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-xl);
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ============================================
   ANIMATIONS
   ============================================ */

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger > * {
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }

/* Page transition */
.page-content {
    animation: pageIn 0.4s ease forwards;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ============================================
   CONFIRM DIALOG
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

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

.modal-dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-dialog h3 {
    margin-bottom: var(--space-sm);
}

.modal-dialog p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-xl);
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .cert-detail-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    #certificatesCardGrid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    :root {
        --space-3xl: 3rem;
        --space-2xl: 2rem;
        --space-xl: 1.5rem;
        --space-lg: 1.25rem;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .content-header {
        padding: var(--space-md);
    }

    .content-body {
        padding: var(--space-md);
    }

    .login-wrapper {
        padding: var(--space-md);
    }

    .login-card {
        margin: 0;
    }

    .verify-card {
        margin: 0;
        width: 100%;
    }
    
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: var(--space-md);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    #certificatesCardGrid {
        grid-template-columns: 1fr !important;
    }

    .content-header {
        flex-wrap: wrap;
        gap: var(--space-md);
    }

    .content-header .header-actions {
        width: 100%;
    }

    .search-container {
        max-width: 100%;
        flex: 1;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    :root {
        --space-3xl: 2rem;
        --space-2xl: 1.5rem;
        --space-xl: 1.25rem;
        --space-lg: 1rem;
    }

    .login-brand h1 {
        font-size: 1.75rem;
    }

    .login-brand .brand-icon {
        width: 60px;
        height: 60px;
    }

    .login-brand .brand-icon svg {
        width: 36px;
        height: 36px;
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }

    .verify-footer {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .verify-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-gold { color: var(--accent-gold); }
.text-blue { color: var(--accent-blue); }
.text-emerald { color: var(--accent-emerald); }
.text-rose { color: var(--accent-rose); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full { width: 100%; }
.hidden { display: none !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   Template Designer & Template System
   ============================================ */

/* Template Cards */
.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.template-select-card:hover {
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 0 2px rgba(246, 196, 69, 0.2) !important;
}

/* Mode Toggle */
.mode-btn {
    background: transparent;
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent-gold) !important;
    color: #000 !important;
}

/* Template Designer Canvas */
.template-canvas-wrapper {
    background: rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

.template-canvas-wrapper:hover {
    border-color: var(--accent-gold) !important;
}

/* Field Overlays */
.tpl-field-overlay {
    transition: box-shadow 0.15s;
}

.tpl-field-overlay.selected {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    z-index: 10 !important;
}

.tpl-field-overlay:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Resize Handles */
.tpl-field-overlay:not(.selected) .resize-handle {
    display: none !important;
}

.resize-handle {
    transition: transform 0.1s;
}

.resize-handle:hover {
    transform: scale(1.3);
    background: var(--accent-blue) !important;
}

/* Field List Items */
.field-list-item {
    transition: background 0.15s;
}

.field-list-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.field-list-item.active {
    background: rgba(59, 130, 246, 0.1) !important;
    border-left: 3px solid var(--accent-blue);
}

/* Badge Violet */
.badge-violet {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Print Styles */
@media print {
    .sidebar, .content-header, .header-actions,
    .toast-container, .modal-overlay, .card-header,
    .nav-item, .btn, button, .stats-grid {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .cert-preview {
        border: none !important;
        box-shadow: none !important;
    }

    .cert-preview img {
        max-width: 100% !important;
        max-height: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}
