/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --header-gradient: linear-gradient(135deg, #1e3a8a 0%, #0891b2 50%, #06b6d4 100%);
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideUp 0.6s ease-out;
}

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

.login-card h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.login-card .subtitle {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 1.05rem;
}

/* Login Demo Badge */
.login-demo-badge {
    position: absolute;
    top: -15px;
    right: -15px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    animation: pulse 2s ease-in-out infinite;
    z-index: 10;
}

.demo-badge-icon {
    font-size: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

.demo-badge-text {
    text-transform: uppercase;
}

/* Login Demo Info Box */
.login-demo-info {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 25px;
    text-align: left;
}

.demo-info-title {
    font-weight: 700;
    color: #92400e;
    margin: 0 0 10px 0;
    font-size: 0.95rem;
}

.demo-info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.demo-info-list li {
    color: #78350f;
    font-size: 0.9rem;
    padding: 4px 0;
    line-height: 1.5;
}

.demo-info-upgrade {
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #fbbf24;
    text-align: center;
}

.demo-info-upgrade a {
    color: #ea580c;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.demo-info-upgrade a:hover {
    color: #c2410c;
    transform: scale(1.05);
}

/* Auto Login Info */
.auto-login-info {
    text-align: center;
    padding: 30px 20px;
}

.auto-login-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 15px;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-info {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-info small {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Header */
.app-header {
    background: var(--header-gradient);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    padding: 18px 0;
}

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

.header-brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-brand h1 {
    font-size: 1.6rem;
    color: white;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-brand .subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Header Navigation (Horizontal) */
.header-nav {
    display: flex;
    gap: 6px;
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 20px;
}

.header-nav::-webkit-scrollbar {
    display: none;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-actions .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.header-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-weight: 600;
    position: relative;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: white;
    font-weight: 700;
}

/* Main Content */
.app-main {
    padding: 20px 0;
    min-height: calc(100vh - 150px);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeInPage 0.5s ease-out;
}

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

.page h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 12px;
}

.page h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--bg-gradient);
    border-radius: 2px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--primary-light);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.form-group input:valid:not(:placeholder-shown),
.form-group select:valid:not(:placeholder-shown),
.form-group textarea:valid:not(:placeholder-shown) {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.form-group input:invalid:not(:placeholder-shown):focus,
.form-group select:invalid:not(:placeholder-shown):focus,
.form-group textarea:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-group input:valid:not(:placeholder-shown):focus,
.form-group select:valid:not(:placeholder-shown):focus,
.form-group textarea:valid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.form-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--bg-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn-secondary:hover {
    background: #475569;
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-small, .btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--bg-gradient);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-icon {
    font-size: 2.5rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-info h3 {
    font-size: 1.75rem;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
    font-weight: 700;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-container:hover {
    box-shadow: var(--shadow-lg);
}

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

.data-table thead {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.data-table th {
    padding: 18px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.data-table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-table .empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 50px;
    font-size: 1.05rem;
}

.data-table td:last-child {
    text-align: center;
    vertical-align: middle;
}

.data-table th:last-child {
    text-align: center;
}

/* Search Box */
.search-box {
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>') no-repeat 16px center;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

/* Filter Section */
.filter-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-section:hover {
    box-shadow: var(--shadow-lg);
}

/* Recent Section */
.recent-section {
    margin-top: 24px;
}

.recent-section h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Student Info */
.student-info {
    margin-top: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    font-size: 0.95rem;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.student-info.active {
    border: 2px solid var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* Report Controls */
.report-controls {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.report-controls:hover {
    box-shadow: var(--shadow-lg);
}

.report-summary {
    margin-bottom: 24px;
}

.report-summary h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-by-class {
    margin-bottom: 24px;
}

.report-by-class h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.export-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-section:hover {
    box-shadow: var(--shadow-lg);
}

.export-section h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Settings Sections */
.settings-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.settings-section h3 {
    margin-bottom: 20px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 12px;
}

.settings-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--bg-gradient);
    border-radius: 2px;
}

.backup-controls,
.data-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.backup-info {
    padding: 15px;
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: 8px;
    margin-top: 15px;
}

.about-info {
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-info p {
    margin-bottom: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(99, 102, 241, 0.1);
    animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.modal-header h3 {
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.25rem;
}

.modal-close {
    background: rgba(99, 102, 241, 0.1);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close:hover {
    background: var(--bg-gradient);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-primary);
    color: white;
    padding: 18px 28px;
    border-radius: 14px;
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    transform: translateX(150%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 420px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

/* Action Buttons in Tables */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.action-buttons .btn {
    min-width: 36px;
    padding: 6px 10px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Print Styles */
@media print {
    .app-header,
    .app-nav,
    .page-header button,
    .export-section,
    .filter-section,
    .form-actions,
    .action-buttons {
        display: none !important;
    }

    body {
        background: white;
    }

    .table-container {
        box-shadow: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .page h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }

    .header-brand {
        order: 1;
        flex: 0 0 auto;
    }

    .header-actions {
        order: 2;
        flex: 0 0 auto;
    }

    .header-nav {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
        gap: 6px;
        padding-top: 10px;
        border-top: 1px solid rgba(99, 102, 241, 0.1);
    }

    .nav-btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    .header-brand h1 {
        font-size: 1.25rem;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }

    .form-actions,
    .export-buttons,
    .backup-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .toast {
        right: 15px;
        left: 15px;
        bottom: 15px;
    }

    .login-card {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border-radius: 10px;
    border: 2px solid var(--bg-color);
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-gradient);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 20px auto 0;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Badge */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Highlight */
.highlight {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
   ======================================== */

/* Tablet & Small Desktop (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 12px;
    }
    
    .header-nav {
        gap: 4px;
        padding: 0 10px;
    }
    
    .nav-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
    }
}

/* Mobile Landscape & Tablet Portrait (max-width: 768px) */
@media (max-width: 768px) {
    /* Header Adjustments */
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 0;
    }
    
    .container {
        padding: 0 12px;
    }
    
    /* Header */
    .app-header {
        position: relative;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px 0;
    }
    
    .header-brand {
        width: 100%;
        justify-content: center;
    }
    
    .header-brand h1 {
        font-size: 1.3rem;
    }
    
    .header-brand .subtitle {
        font-size: 0.8rem;
    }
    
    /* Navigation - Horizontal Scroll */
    .header-nav {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        scrollbar-width: thin;
        display: flex;
        gap: 8px;
    }
    
    .header-nav::-webkit-scrollbar {
        height: 4px;
    }
    
    .header-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
    }
    
    .header-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
    
    .nav-btn {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 8px 16px;
        flex-shrink: 0;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .header-actions .btn {
        flex: 1;
        max-width: 200px;
    }
    
    /* Main Content */
    .app-main {
        padding: 16px 0;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    /* Page Headers */
    .page h2 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 16px;
    }
    
    .page-header-actions {
        width: 100%;
    }
    
    .page-header-actions .btn {
        width: 100%;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .form-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .form-actions {
        margin-top: 12px;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 600px;
    }
    
    th, td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .btn-small, .btn-sm {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Action Buttons */
    .action-buttons {
        gap: 4px;
    }
    
    .action-buttons .btn {
        min-width: 32px;
        padding: 5px 8px;
        font-size: 0.9rem;
    }
    
    /* Recent Payments */
    .recent-payments {
        padding: 16px;
    }
    
    .payment-item {
        padding: 12px;
    }
}

/* Mobile Portrait (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .app-main {
        padding: 12px 0;
    }
    
    /* Header */
    .header-brand h1 {
        font-size: 1.1rem;
    }
    
    .header-brand .subtitle {
        font-size: 0.65rem;
    }
    
    .header-brand-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    .nav-btn {
        padding: 7px 12px;
        font-size: 0.8rem;
    }
    
    .header-actions .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    /* Stats */
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        margin: 0 auto;
    }
    
    /* Page Title */
    .page h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    /* Forms */
    .form-card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .form-row {
        margin-bottom: 12px;
    }
    
    .form-actions {
        margin-top: 12px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 0.95rem;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    /* Login Card */
    .login-card {
        padding: 30px 20px;
    }
    
    .login-card h1 {
        font-size: 1.8rem;
    }
    
    /* Tables - Better Mobile View */
    table {
        font-size: 0.75rem;
        min-width: 500px;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    /* Toast */
    .toast {
        width: 90%;
        max-width: 90%;
        left: 5%;
        right: 5%;
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }
    
    .header-brand h1 {
        font-size: 1rem;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stats-grid {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .form-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .page-header {
        margin-bottom: 12px;
    }
    
    table {
        font-size: 0.7rem;
    }
}

/* Landscape Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        position: relative;
    }
    
    .header-content {
        padding: 8px 0;
    }
    
    .header-brand-icon {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .header-brand h1 {
        font-size: 1rem;
    }
    
    .header-brand .subtitle {
        display: none;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .app-main {
        padding: 12px 0;
    }
    
    .page h2 {
        margin-bottom: 12px;
    }
}

/* ========================================
   DEMO VERSION STYLES
   ======================================== */

/* Demo Watermark - HIDDEN */
.demo-watermark {
    display: none !important;
}

.watermark-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watermark-text {
    letter-spacing: 1px;
    text-transform: uppercase;
}

.watermark-upgrade {
    background: white;
    color: #ff6b35;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.watermark-upgrade:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Demo Banner */
.demo-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 2px solid #f59e0b;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.demo-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.demo-banner-icon {
    font-size: 1.2rem;
}

.demo-banner-text {
    color: #78350f;
    font-size: 0.9rem;
    text-align: center;
}

.demo-banner-text strong {
    color: #92400e;
    font-weight: 700;
}

.demo-banner-link {
    color: #ea580c;
    font-weight: 700;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.demo-banner-link:hover {
    color: #c2410c;
}

.demo-banner-close {
    background: transparent;
    border: none;
    color: #78350f;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.3s ease;
}

.demo-banner-close:hover {
    color: #92400e;
}

/* Premium Modal */
.premium-modal .modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.premium-content {
    text-align: center;
    padding: 20px;
}

.premium-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.premium-content h2 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.8rem;
}

.premium-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.premium-features {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.premium-features h4 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.premium-features ul {
    list-style: none;
    padding: 0;
}

.premium-features li {
    padding: 8px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.premium-features li strong {
    color: var(--primary-dark);
}

.premium-price {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.price-tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.price-amount {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.price-period {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

.price-note {
    font-size: 0.9rem;
    opacity: 0.95;
    margin: 0;
}

.premium-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
    flex-wrap: wrap;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 700;
}

.demo-info {
    background: #fef3c7;
    border: 2px solid #fde68a;
    border-radius: 8px;
    padding: 16px;
    margin-top: 24px;
    text-align: left;
}

.demo-info p {
    margin: 4px 0;
    color: #78350f;
    font-size: 0.9rem;
}

.demo-info p:first-child {
    font-weight: 700;
    margin-bottom: 8px;
}

/* Premium Feature Lock Badge */
.premium-lock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-lock:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* Disabled Premium Features */
.btn-premium-locked {
    position: relative;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-premium-locked::after {
    content: '🔒';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* Demo Limit Warning */
.demo-limit-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.demo-limit-warning .warning-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.demo-limit-warning .warning-text {
    color: #78350f;
    font-size: 0.9rem;
    flex: 1;
}

.demo-limit-warning .warning-text strong {
    color: #92400e;
    font-weight: 700;
}

/* Responsive Demo Styles */
@media (max-width: 768px) {
    /* Login Demo Badge */
    .login-demo-badge {
        top: -12px;
        right: -12px;
        padding: 6px 16px;
        font-size: 0.75rem;
    }
    
    .demo-badge-icon {
        font-size: 0.9rem;
    }
    
    /* Login Demo Info */
    .login-demo-info {
        padding: 12px;
    }
    
    .demo-info-title {
        font-size: 0.85rem;
    }
    
    .demo-info-list li {
        font-size: 0.85rem;
    }
    
    .demo-info-upgrade a {
        font-size: 0.85rem;
    }
    
    .demo-watermark {
        top: 60px;
        right: 10px;
        padding: 6px 12px;
        font-size: 0.65rem;
    }
    
    .watermark-upgrade {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    
    .demo-banner {
        padding: 8px 0;
    }
    
    .demo-banner-text {
        font-size: 0.8rem;
    }
    
    .premium-content h2 {
        font-size: 1.5rem;
    }
    
    .premium-icon {
        font-size: 3rem;
    }
    
    .price-amount {
        font-size: 2rem;
    }
    
    .premium-actions {
        flex-direction: column;
    }
    
    .btn-large {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Login Demo Badge - Mobile */
    .login-demo-badge {
        position: static;
        margin: 0 auto 15px;
        display: inline-flex;
    }
    
    .login-card {
        padding: 40px 25px;
    }
    
    .demo-watermark {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        justify-content: center;
    }
    
    .demo-banner-content {
        font-size: 0.75rem;
        padding: 0 8px;
    }
    
    .premium-features li {
        font-size: 0.85rem;
    }
}
