/* ===================================
   CGPA CALCULATOR - ORGANIZED CSS
   Mobile First Design with Desktop Overrides
   All Media Queries at End
   =================================== */

/* === BASE RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === CSS VARIABLES === */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-hover: #1d4ed8;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* === BODY === */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: var(--text-primary);
}

/* === CONTAINER === */
.container {
    max-width: 1400px;
    margin: 10px auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* === HEADER === */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px 15px;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-weight: 700;
    line-height: 1.3;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.95;
    margin-bottom: 5px;
}

.subtitle-small {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* === STUDENT INFO SECTION === */
.student-info-section {
    background: var(--bg-color);
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.student-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.department-select-full {
    grid-column: 1 / -1;
}

.student-input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.student-input-group input,
.student-input-group select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: white;
}

.student-input-group select {
    cursor: pointer;
}

.student-input-group input:focus,
.student-input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.detected-session {
    display: inline-block;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

/* === GRADE SCALE === */
.grade-scale {
    background: var(--bg-color);
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.grade-scale h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.grade-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grade-info span {
    background: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* === SUMMARY SECTION === */
.summary-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.summary-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cgpa-display {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.percentage-display {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.credit-display {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 5px;
}

.credit-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-display {
    font-size: 1rem;
    font-weight: 600;
    padding: 8px;
    border-radius: 8px;
    margin-top: 5px;
}

/* Status Colors */
.status-excellent {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.status-good {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.status-satisfactory {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-warning {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #9a3412;
}

.status-critical {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* === TARGET SECTION === */
.target-section {
    background: white;
    margin: 20px 30px;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.target-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.target-inputs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.target-result {
    margin-top: 20px;
}

.target-achievable,
.target-impossible,
.target-achieved {
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.target-achievable {
    background-color: rgba(46, 204, 113, 0.1);
    border-left: 4px solid var(--success-color);
}

.target-impossible {
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--error-color);
}

.target-achieved {
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 4px solid var(--primary-color);
}

.target-achievable h4,
.target-impossible h4,
.target-achieved h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
}

.target-achievable p,
.target-impossible p,
.target-achieved p {
    margin: 5px 0;
}

.warning-text {
    color: var(--error-color);
    font-weight: 600;
}

.info-text {
    color: var(--success-color);
    font-weight: 600;
}

/* === SEMESTER BLOCKS === */
.all-semesters {
    padding: 10px;
}

.semester-block {
    background: var(--bg-color);
    margin-bottom: 15px;
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.semester-header-block {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.semester-info {
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: var(--text-primary);
    flex-wrap: wrap;
    padding: 8px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    border-radius: 8px;
}

.semester-info span {
    font-size: 0.7rem;
}

.semester-info strong {
    color: var(--primary-color);
    margin-right: 5px;
}

.semester-gpa-display {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.semester-gpa-display strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* === TABLE VIEW (All Screens with Horizontal Scroll) === */
.courses-table-container {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
}

.courses-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.courses-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.courses-table th {
    padding: 6px 3px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    white-space: nowrap;
}

.courses-table td {
    padding: 4px 2px;
    border-bottom: 1px solid var(--border-color);
}

.courses-table tbody tr:hover {
    background: var(--bg-color);
}

.sl-no {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    width: 30px;
    font-size: 0.6rem;
}

.letter-grade {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.6rem;
    width: 35px;
}

/* === INPUT FIELDS === */
.course-code,
.course-name,
.course-credit {
    width: 100%;
    padding: 3px 2px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.45rem;
    min-height: 26px;
}

.course-name {
    font-size: 0.43rem;
}

.course-code:focus,
.course-name:focus,
.course-credit:focus {
    outline: none;
    border-color: var(--primary-color);
}

.course-grade-current,
.course-grade-expected {
    width: 100%;
    padding: 3px 1px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.48rem;
    background: white;
    min-height: 26px;
}

.course-grade-current:focus,
.course-grade-expected:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* === REMOVE BUTTON === */
.remove-course-btn {
    background: var(--error-color);
    color: white;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.remove-course-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.remove-course-btn:active {
    transform: scale(0.95);
}

/* === SEMESTER SUMMARY === */
.semester-summary {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    gap: 10px;
    margin: 6px 0;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.summary-row span {
    color: var(--text-primary);
    white-space: nowrap;
}

.summary-row strong {
    color: var(--primary-color);
    margin-left: 3px;
}

/* === BUTTONS === */
.add-course-btn-sem {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    flex: 0 1 auto;
    min-width: auto;
}

.add-course-btn-sem:hover {
    background: #059669;
    transform: translateY(-2px);
}

.add-course-btn-sem:active {
    transform: translateY(0);
}

.reset-semester-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    flex: 0 1 auto;
    min-width: auto;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.reset-semester-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.reset-semester-btn:active {
    transform: translateY(0);
}

.semester-actions {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.recalculate-btn-sem {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--primary-color);
    color: white;
    transition: all 0.3s ease;
}

.recalculate-btn-sem:hover {
    background: #1565c0;
    transform: translateY(-2px);
}

/* === SEMESTER TARGET CALCULATOR === */
.semester-target {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.semester-target h4 {
    margin: 0 0 15px 0;
    color: var(--text-color);
    font-size: 1.1rem;
}

.semester-target-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.semester-target-inputs label {
    font-weight: 500;
    color: var(--text-color);
}

.semester-target-inputs input {
    padding: 8px 12px;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 1rem;
    width: 120px;
}

.calculate-target-sem-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.calculate-target-sem-btn:hover {
    background-color: #1565c0;
}

.semester-target-result {
    margin-top: 15px;
}

.toggle-target-btn {
    width: 100%;
    padding: 10px;
    background-color: #34495e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.toggle-target-btn:hover {
    background-color: #2c3e50;
}

/* === ACTION BUTTONS === */
.action-buttons-main {
    display: flex;
    gap: 10px;
    padding: 15px;
    flex-wrap: wrap;
}

.calculate-btn,
.calculate-btn-main,
.reset-btn-main,
.save-btn,
.load-btn {
    flex: 1;
    min-width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.calculate-btn,
.calculate-btn-main {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.calculate-btn:hover,
.calculate-btn-main:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.reset-btn-main {
    background: var(--error-color);
    color: white;
}

.reset-btn-main:hover {
    background: #dc2626;
}

.save-btn {
    background: var(--success-color);
    color: white;
}

.save-btn:hover {
    background: #059669;
}

.load-btn {
    background: var(--warning-color);
    color: white;
}

.load-btn:hover {
    background: #d97706;
}

/* === BOTTOM SUMMARY SECTION === */
.bottom-summary-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    padding: 30px;
    margin: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.bottom-summary-section h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.bottom-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.bottom-summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.bottom-summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bottom-summary-card h4 {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bottom-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0;
}

.bottom-subtext {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === SMART TARGET CALCULATOR === */
.smart-target-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    margin: 15px 10px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.smart-target-header {
    text-align: center;
    margin-bottom: 20px;
}

.smart-target-header h3 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.smart-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 400;
}

.smart-target-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.smart-card-content {
    padding: 15px;
}

.smart-inputs-grid {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.smart-inputs-grid .input-group {
    flex: 1;
    min-width: 100%;
}

.smart-inputs-grid .input-group label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.smart-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.smart-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.smart-calculate-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.smart-calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.smart-calculate-btn:active {
    transform: translateY(0);
}

.smart-target-result {
    margin-top: 20px;
}

.smart-target-result .target-achievable,
.smart-target-result .target-impossible,
.smart-target-result .target-achieved {
    animation: slideIn 0.4s ease-out;
}

.advanced-target-result {
    margin-top: 20px;
}

.advanced-target-result hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
}

/* === GRADE DISTRIBUTION SECTION === */
.grade-distribution-section {
    background: var(--bg-color);
    padding: 15px;
    margin: 15px 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.grade-distribution-header {
    text-align: center;
    margin-bottom: 15px;
}

.grade-distribution-header h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.grade-distribution-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.grade-distribution-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
}

.chart-container {
    position: relative;
    height: 250px;
    margin-bottom: 20px;
}

.grade-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* === FOOTER === */
footer {
    background: var(--bg-color);
    padding: 15px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    line-height: 1.5;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === CUSTOM MODAL STYLES === */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
    padding: 20px;
}

.custom-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
    animation: slideDown 0.3s ease-out;
    overflow: hidden;
}

.custom-modal-header {
    padding: 24px 24px 16px;
    text-align: center;
}

.custom-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.modal-icon-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.modal-icon-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.modal-icon-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.custom-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.custom-modal-body {
    padding: 0 24px 24px;
    text-align: center;
}

.custom-modal-message {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.custom-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-btn:active {
    transform: translateY(0);
}

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.modal-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.modal-btn-cancel {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-btn-cancel:hover {
    background: #e2e8f0;
}

.modal-btn-ok {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

/* ===================================
   MEDIA QUERIES - DESKTOP (1024px+)
   =================================== */

@media (min-width: 1024px) {
    /* Body & Container */
    body {
        padding: 20px;
    }
    
    .container {
        margin: 0 auto;
    }
    
    /* Header */
    header {
        padding: 30px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.05rem;
    }
    
    .subtitle-small {
        font-size: 0.9rem;
    }
    
    /* Student Info */
    .student-info-section {
        grid-template-columns: repeat(3, 1fr);
        padding: 20px 30px;
        gap: 20px;
    }
    
    /* Grade Scale */
    .grade-scale {
        padding: 15px 30px;
    }
    
    .grade-scale h3 {
        font-size: 1rem;
    }
    
    .grade-info {
        gap: 10px;
    }
    
    .grade-info span {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
    
    /* Summary Section */
    .summary-section {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        padding: 30px;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .summary-card h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .cgpa-display {
        font-size: 3rem;
    }
    
    .percentage-display {
        font-size: 0.9rem;
    }
    
    .credit-display {
        font-size: 2.5rem;
    }
    
    .credit-info {
        font-size: 0.9rem;
    }
    
    .status-display {
        font-size: 1.3rem;
        padding: 10px;
    }
    
    /* Semesters */
    .all-semesters {
        padding: 20px 30px;
    }
    
    .semester-block {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .semester-info {
        gap: 30px;
        font-size: 0.95rem;
        padding: 10px;
    }
    
    .semester-info span {
        font-size: 0.9rem;
    }
    
    /* Table Styling */
    .courses-table {
        min-width: auto;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .courses-table th {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .courses-table td {
        padding: 6px;
    }
    
    .sl-no {
        width: 50px;
        font-size: 0.8rem;
    }
    
    .letter-grade {
        font-size: 0.8rem;
        width: 80px;
    }
    
    /* Input Fields - Desktop */
    .course-code,
    .course-name,
    .course-credit {
        padding: 6px;
        font-size: 0.8rem;
        min-height: auto;
    }
    
    .course-code {
        max-width: 120px;
    }
    
    .course-grade-current,
    .course-grade-expected {
        padding: 6px;
        font-size: 0.8rem;
        min-height: auto;
    }
    
    /* Remove Button */
    .remove-course-btn {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }
    
    /* Semester Summary */
    .semester-summary {
        padding: 15px 20px;
        margin-top: 10px;
    }
    
    .summary-row {
        gap: 30px;
        margin: 8px 0;
        font-size: 0.95rem;
    }
    
    .summary-row strong {
        margin-left: 5px;
    }
    
    /* Buttons */
    .add-course-btn-sem {
        width: auto;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .semester-actions {
        gap: 10px;
        margin: 15px 0;
    }
    
    .action-buttons-main {
        gap: 15px;
        padding: 20px 30px;
    }
    
    .calculate-btn,
    .calculate-btn-main,
    .reset-btn-main,
    .save-btn,
    .load-btn {
        min-width: 150px;
        padding: 14px 24px;
        font-size: 1rem;
    }
    
    /* Smart Target Section */
    .smart-target-section {
        padding: 25px 30px;
        margin: 20px 30px;
    }
    
    .smart-card-content {
        padding: 25px;
    }
    
    .smart-inputs-grid {
        gap: 15px;
    }
    
    .smart-inputs-grid .input-group {
        min-width: 200px;
    }
    
    /* Grade Distribution */
    .grade-distribution-section {
        padding: 25px 30px;
        margin: 20px 30px;
    }
    
    .grade-distribution-header h3 {
        font-size: 1.6rem;
    }
    
    .grade-distribution-subtitle {
        font-size: 0.95rem;
    }
    
    .grade-distribution-card {
        padding: 25px;
    }
    
    .chart-container {
        height: 320px;
    }
    
    .grade-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    /* Footer */
    footer {
        padding: 20px 30px;
        font-size: 0.9rem;
    }
}

/* === MOBILE SPECIFIC (max-width: 1023px) === */
@media (max-width: 1023px) {
    /* Prevent zoom on input focus for iOS */
    input[type="text"],
    input[type="number"],
    select {
        font-size: 16px;
    }
    
    /* Make text selections easier on mobile */
    input,
    select,
    button {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
}
