/* Smart Party Building Platform - Clean Modern Light Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --font-heading: 'Outfit', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-body: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    
    /* Clean Light Theme with Elegant Party Red Accent */
    --bg-main: #f4f6f9;
    --bg-card: #ffffff;
    --bg-card-solid: #ffffff;
    --bg-card-hover: #f8fafc;
    
    --border-color: #e2e8f0;
    --border-hover: #fca5a5;
    
    --party-red: #cc1f1f;
    --party-red-dark: #991b1b;
    --party-gold: #b45309;
    --party-gold-glow: rgba(180, 83, 9, 0.08);
    
    --primary-gradient: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    --gold-gradient: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --light-gradient: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.09);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 10%, rgba(220, 38, 38, 0.03) 0px, transparent 45%),
        radial-gradient(at 90% 10%, rgba(217, 119, 6, 0.03) 0px, transparent 45%),
        radial-gradient(at 50% 90%, rgba(185, 28, 28, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 2rem;
    flex: 1;
}

/* Header Navbar */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.brand-emblem {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
    color: #ffffff;
    transition: var(--transition);
}

.brand:hover .brand-emblem {
    transform: scale(1.05);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(to right, #b91c1c, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    gap: 0.35rem;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.nav-item {
    padding: 0.55rem 1.35rem;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.nav-item:hover {
    color: var(--party-red);
    background: rgba(220, 38, 38, 0.06);
}

.nav-item.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    min-width: 170px;
    z-index: 300;
}

/* Invisible hover bridge connecting parent button and dropdown menu */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    width: 100%;
    height: 16px;
    background: transparent;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.open .dropdown-menu {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--party-red);
}

.dropdown-item.active {
    background: var(--primary-gradient);
    color: #ffffff;
}

.org-link {
    color: var(--party-red);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.org-link:hover {
    color: var(--party-red-dark);
    text-decoration: underline;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1rem;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.role-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

.role-tag.admin {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.role-tag.school {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.btn-logout {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* View Section */
.view-section {
    display: none;
    animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-section.active {
    display: block;
}

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

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
}

.stat-card.gold::before {
    background: var(--gold-gradient);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.stat-info h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* Page Control Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.page-title h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.page-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.action-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    position: relative;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--party-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
    background: #ffffff;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Select Control */
.select-control {
    padding: 0.65rem 1rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    max-width: 240px;
}

.select-control:focus {
    border-color: var(--party-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid #cbd5e1;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--party-red);
    color: var(--party-red);
}

/* Tables */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: #f8fafc;
    padding: 1.1rem 1.4rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-red {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.badge-gold {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-green {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* Actions Cell */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-icon.edit:hover {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.btn-icon.delete:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.6rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-page {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
    background: #f1f5f9;
}

.btn-page:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    padding: 2.2rem;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text-primary);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.6rem;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.35rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--party-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Login Full View */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(circle at center, rgba(220, 38, 38, 0.06) 0%, #f4f6f9 70%);
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 2.75rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3);
    color: #ffffff;
}

.login-brand h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

.login-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    padding: 0.3rem;
    margin-bottom: 1.6rem;
    border: 1px solid var(--border-color);
}

.login-tab {
    flex: 1;
    text-align: center;
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.login-tab.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 0.9rem 1.35rem;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 300px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Detail Display Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.2rem;
}

.detail-item span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
