/* ============================================
   GradeFlow - Main Stylesheet
   ============================================ */

:root {
    --primary: #137fec;
    --primary-hover: #1a8fff;
    --primary-10: rgba(19, 127, 236, 0.1);
    --primary-20: rgba(19, 127, 236, 0.2);
    --primary-40: rgba(19, 127, 236, 0.4);
    
    --bg-dark: #101922;
    --bg-card: #192633;
    --bg-input: #111a22;
    --bg-hover: #1f2d3d;
    
    --border: #233648;
    --border-light: #324d67;
    
    --text-primary: #ffffff;
    --text-secondary: #92adc9;
    --text-muted: #506c88;
    
    --success: #0bda5b;
    --success-10: rgba(11, 218, 91, 0.1);
    --warning: #fa6238;
    --warning-10: rgba(250, 98, 56, 0.1);
    --orange: #f97316;
    --orange-10: rgba(249, 115, 22, 0.1);
    
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2.5rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-10);
    border-radius: var(--radius-lg);
    color: var(--primary);
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    padding-bottom: 0.25rem;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 1rem;
    height: 40px;
    min-width: 200px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 100%;
    margin-left: 0.5rem;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box .material-symbols-outlined {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--primary-20);
    background-size: cover;
    background-position: center;
    cursor: pointer;
}

/* ============================================
   Page Header
   ============================================ */

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--orange-10);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-full);
    color: var(--orange);
    font-size: 0.875rem;
    font-weight: 700;
}

.streak-badge .material-symbols-outlined {
    font-size: 1.25rem;
}

.filled {
    font-variation-settings: 'FILL' 1;
}

/* ============================================
   Stats Cards
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--primary-40);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 300;
}

.stat-value-text {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0.25rem 0;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
}

.stat-change.positive {
    background: var(--success-10);
    color: var(--success);
}

.stat-change.negative {
    background: var(--warning-10);
    color: var(--warning);
}

.stat-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 300;
    margin-top: 0.5rem;
}

.stat-sub.positive {
    color: var(--success);
    font-weight: 500;
}

.stat-sub.warning {
    color: var(--orange);
    font-weight: 500;
}

.trend-icon {
    color: var(--primary);
    font-size: 1rem;
}

/* ============================================
   Sections
   ============================================ */

.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.link-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.link-btn:hover {
    text-decoration: underline;
}

/* ============================================
   Goals
   ============================================ */

.goals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.goal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
}

.goal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.goal-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.goal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
}

.goal-icon.primary {
    background: var(--primary-10);
    color: var(--primary);
}

.goal-icon.success {
    background: var(--success-10);
    color: var(--success);
}

.goal-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.goal-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.goal-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-fill.primary {
    background: var(--primary);
}

.progress-fill.success {
    background: var(--success);
}

.progress-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================
   Expand Button
   ============================================ */

.expand-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 56px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2rem;
}

.expand-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-40);
    color: var(--text-primary);
}

/* ============================================
   Table
   ============================================ */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

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

.data-table thead {
    background: var(--bg-input);
}

.data-table th {
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.subject-name {
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.participated {
    background: var(--success-10);
    color: var(--success);
}

.status-badge.not-participated {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.participated .status-dot {
    background: var(--success);
}

.status-badge.not-participated .status-dot {
    background: var(--text-secondary);
}

.entry-description {
    color: var(--text-secondary);
    font-weight: 300;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.load-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.load-more-btn:hover {
    color: var(--primary);
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 1.5rem 2.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   Forms
   ============================================ */

form {
    padding: 1.5rem;
}

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

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

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

input::placeholder, textarea::placeholder {
    color: var(--text-secondary);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2392adc9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.status-toggle {
    display: flex;
    gap: 0.5rem;
}

.status-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover {
    border-color: var(--primary-40);
}

.status-btn.active {
    background: var(--primary-10);
    border-color: var(--primary);
    color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(19, 127, 236, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: transparent;
    color: var(--warning);
    border: 1px solid rgba(250, 98, 56, 0.2);
}

.btn-danger:hover {
    background: var(--warning-10);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .goals-grid {
        grid-template-columns: 1fr;
    }
    
    .main-nav {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}