:root {
    --lasu-blue: #003366;
    --lasu-gold: #ffcc00;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --border: #ccd1d9;
    --text-main: #333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #003366 0%, #001a33 100%);
    min-height: 100vh;
    padding: 10px;
}

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

/* Header - Mobile Optimized */
.main-header {
    background: var(--lasu-blue);
    color: white;
    padding: 15px;
    border-radius: 12px 12px 0 0;
    text-align: center;
    border: 2px solid var(--lasu-gold);
    border-bottom: none;
}

.main-header h1 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--lasu-gold);
    word-wrap: break-word;
}

.main-header .subtitle {
    opacity: 0.9;
    font-size: 0.8rem;
    display: block;
}

/* Mode Selector - Stack on Mobile */
.mode-selector {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: white;
    border-left: 2px solid var(--lasu-gold);
    border-right: 2px solid var(--lasu-gold);
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 10px;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
    text-align: center;
    font-size: 0.85rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mode-btn small {
    display: block;
    opacity: 0.7;
    font-weight: normal;
    margin-top: 3px;
    font-size: 0.7rem;
}

.mode-btn.active {
    background: var(--lasu-blue);
    color: white;
    border-color: var(--lasu-gold);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.mode-btn:active {
    transform: scale(0.95);
}

.mode-icon {
    font-size: 1.3rem;
    display: block;
    margin-bottom: 3px;
}

/* Content Area */
.content-area {
    background: var(--bg-color);
    padding: 12px;
    border: 2px solid var(--lasu-gold);
    border-top: none;
    border-radius: 0 0 12px 12px;
}

/* Summary Card - Mobile Grid */
.summary-card {
    background: var(--lasu-blue);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.summary-card h2 {
    text-align: center;
    color: var(--lasu-gold);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.stat-box {
    background: rgba(255,255,255,0.1);
    padding: 10px 5px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.stat-box .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 3px;
    display: block;
}

.stat-box .value {
    font-size: 1.3rem;
    font-weight: bold;
    display: block;
    word-break: break-word;
}

.stat-box.highlight {
    background: rgba(255,204,0,0.2);
    border: 2px solid var(--lasu-gold);
}

.stat-box.highlight .value {
    color: var(--lasu-gold);
}

.status-bar {
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-weight: bold;
    font-size: 0.8rem;
    flex-wrap: wrap;
    display: flex;
    justify-content: center;
    gap: 5px;
}

/* Level Progress */
.level-progress {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 3px;
}

.level-badge {
    padding: 4px 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    font-size: 0.7rem;
    white-space: nowrap;
}

.level-badge.completed {
    background: rgba(40,167,69,0.3);
    border: 1px solid #28a745;
}

.level-badge.current {
    background: rgba(255,204,0,0.3);
    border: 1px solid var(--lasu-gold);
}

/* Form Sections */
.form-section {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-section h3 {
    color: var(--lasu-blue);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--lasu-gold);
    font-size: 1rem;
}

.sim-description {
    color: #666;
    margin-bottom: 12px;
    font-size: 0.8rem;
}

/* Form Rows - Stack on Mobile */
.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-row input,
.form-row select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.85rem;
    flex: 1;
    min-width: 120px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: white;
}

.form-row select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' 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 8px center;
    background-size: 16px;
    padding-right: 30px;
}

/* Buttons - Touch Friendly */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 0.85rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-primary {
    background: var(--lasu-blue);
    color: white;
}

.btn-primary:hover {
    background: #002244;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-gold {
    background: var(--lasu-gold);
    color: var(--lasu-blue);
    font-weight: bold;
}

.btn-gold:hover {
    background: #e6b800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-predict {
    background: #8e44ad;
    color: white;
    animation: pulse 2s infinite;
}

.btn-predict:hover {
    background: #7d3c98;
}

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

/* Semester Cards - Scrollable on Mobile */
.semester-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.semester-header {
    background: linear-gradient(135deg, var(--lasu-blue), #002244);
    color: white;
    padding: 10px 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
}

.semester-header span {
    flex: 1;
    min-width: 150px;
}

.btn-delete {
    color: var(--lasu-gold);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    padding: 5px;
    font-size: 0.8rem;
    -webkit-tap-highlight-color: transparent;
}

.ai-badge {
    color: #ffcc00;
    font-size: 0.8rem;
}

/* Course Input Row - Mobile Stack */
.course-input-row {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.course-input-row input,
.course-input-row select {
    padding: 8px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    flex: 1;
    min-width: 60px;
    -webkit-appearance: none;
}

.course-input-row input {
    min-width: 100px;
}

/* Table - Horizontal Scroll on Mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th {
    background: #f4f6f8;
    padding: 8px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #666;
    border-bottom: 2px solid var(--lasu-gold);
    white-space: nowrap;
}

td {
    padding: 8px 5px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
}

.text-left {
    text-align: left;
}

.empty-row {
    text-align: center;
    color: #666;
    padding: 20px;
}

.btn-remove {
    color: red;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    padding: 5px;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}

/* Semester Footer */
.semester-footer {
    background: #f8f9fa;
    padding: 10px;
    border-top: 2px solid var(--lasu-gold);
    font-size: 0.75rem;
}

.semester-footer .sem-gpa {
    color: var(--lasu-blue);
    font-weight: bold;
    margin-bottom: 3px;
}

.semester-footer .cum-cgpa {
    color: #d35400;
    font-weight: bold;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--lasu-gold);
    padding: 25px 15px;
    text-align: center;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.upload-area:active {
    background: #f0f0f0;
}

.upload-area.dragover {
    background: rgba(255,204,0,0.1);
    border-color: #28a745;
}

.upload-icon {
    font-size: 2.5rem;
}

.upload-hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* PDF Preview */
.pdf-preview {
    background: white;
    padding: 12px;
    border-radius: 10px;
    margin-top: 12px;
    border: 2px solid var(--lasu-gold);
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pdf-preview h4 {
    color: var(--lasu-blue);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.pdf-preview pre {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.75rem;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

/* Chart Container */
.chart-container {
    height: 250px;
    margin-top: 15px;
}

/* Success/Warning Messages */
.success-message {
    background: #d4edda;
    padding: 12px;
    border-radius: 8px;
    color: #155724;
    font-weight: bold;
    margin-top: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.warning-message {
    background: #fff3cd;
    padding: 12px;
    border-radius: 8px;
    color: #856404;
    font-weight: bold;
    margin-top: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.error-message {
    background: #f8d7da;
    padding: 12px;
    border-radius: 8px;
    color: #721c24;
    font-weight: bold;
    margin-top: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.result-success {
    background: #d4edda;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #28a745;
}

.result-warning {
    background: #fff3cd;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid var(--lasu-gold);
}

.required-gpa {
    font-size: 1.2rem;
}

#simResult {
    padding: 10px;
    border-radius: 5px;
    margin-top: 12px;
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
}

/* Simulation Progress */
.simulation-progress {
    background: #d4edda;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #28a745;
}

.simulation-progress h4 {
    color: #155724;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.simulation-progress p {
    margin: 5px 0;
    color: #155724;
    font-size: 0.8rem;
}

/* Predicted Semester */
.predicted-semester {
    border: 3px dashed #8e44ad !important;
    background: #faf5ff !important;
}

.predicted-semester .semester-header {
    background: linear-gradient(135deg, #8e44ad, #6c3483) !important;
}

/* Hidden */
.hidden {
    display: none;
}

/* Mobile-Specific Styles */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .main-header {
        padding: 12px 10px;
    }

    .main-header h1 {
        font-size: 1.1rem;
    }

    .main-header .subtitle {
        font-size: 0.7rem;
    }

    .mode-selector {
        flex-direction: column;
        gap: 5px;
        padding: 8px;
    }

    .mode-btn {
        padding: 10px;
        font-size: 0.8rem;
    }

    .mode-btn small {
        font-size: 0.65rem;
    }

    .content-area {
        padding: 8px;
    }

    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .stat-box .value {
        font-size: 1.1rem;
    }

    .stat-box .label {
        font-size: 0.6rem;
    }

    .status-bar {
        font-size: 0.7rem;
        flex-direction: column;
        gap: 3px;
    }

    .form-section {
        padding: 12px;
    }

    .form-row {
        flex-direction: column;
        gap: 6px;
    }

    .form-row input,
    .form-row select {
        width: 100%;
        min-width: auto;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .course-input-row {
        flex-direction: column;
        gap: 5px;
    }

    .course-input-row input,
    .course-input-row select {
        width: 100%;
    }

    .course-input-row input {
        min-width: auto;
    }

    table {
        min-width: 450px;
    }

    th, td {
        padding: 6px 3px;
        font-size: 0.7rem;
    }

    .semester-header {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .semester-footer {
        font-size: 0.7rem;
    }

    .chart-container {
        height: 200px;
    }

    .upload-area {
        padding: 20px 10px;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .pdf-preview {
        max-height: 200px;
    }

    .pdf-preview pre {
        font-size: 0.7rem;
    }

    .level-progress {
        gap: 2px;
    }

    .level-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    #simResult {
        font-size: 0.8rem;
    }

    .simulation-progress p {
        font-size: 0.75rem;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .stat-box {
        padding: 8px 3px;
    }

    .stat-box .value {
        font-size: 1rem;
    }

    .stat-box .label {
        font-size: 0.55rem;
    }

    .mode-btn {
        font-size: 0.75rem;
        padding: 8px;
    }

    .mode-icon {
        font-size: 1.1rem;
    }

    table {
        min-width: 400px;
    }

    th, td {
        padding: 5px 2px;
        font-size: 0.65rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 36px;
    }
}

/* Landscape Mode */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        max-width: 100%;
    }

    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .chart-container {
        height: 180px;
    }

    .mode-selector {
        flex-direction: row;
    }

    .course-input-row {
        flex-direction: row;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .btn, .mode-selector, .upload-area, .course-input-row {
        display: none !important;
    }

    .semester-card {
        break-inside: avoid;
        border: 1px solid #000;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: #999;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

.footer strong {
    color: var(--lasu-blue);
}

.footer .fa-heart {
    animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
}

/* Mobile footer */
@media (max-width: 768px) {
    .footer {
        padding: 15px;
        font-size: 0.75rem;
    }
}