/* DBATU SGPA & CGPA Calculator - Android Native App Feel & Responsive Design */

:root {
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Color Palette (Reference Theme) */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-blue-tint: #eff6ff;
    
    --color-black: #111827;
    --color-white: #ffffff;
    --color-blue: #2563eb;
    --color-blue-border: #3b82f6;
    
    --text-main: #111827;
    --text-muted: #4b5563;
    --text-light: #6b7280;
    
    --border-dark: #111827;
    --border-light: #e5e7eb;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    padding: 1.5rem 1rem 3rem 1rem;
    -webkit-font-smoothing: antialiased;
}

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

/* Header Section */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--border-light);
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #ffffff;
    border: 2px solid var(--border-dark);
    padding: 2px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.brand-title h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--color-black);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Mid Attribution */
.mid-attribution {
    text-align: center;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.mid-attribution a {
    color: var(--color-black);
    font-weight: 800;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.mid-attribution a:hover {
    color: var(--color-blue);
}

/* Help Pill Button */
.btn-help-pill {
    background-color: var(--color-white);
    border: 2px solid var(--color-black);
    color: var(--color-black);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.btn-help-pill:active {
    transform: scale(0.96);
    background-color: var(--color-black);
    color: var(--color-white);
}

/* Material 3 Segmented Navigation Tabs */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background-color: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    border: none;
}

.tab-btn.active {
    background-color: var(--color-black);
    color: var(--color-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.tab-btn.inactive {
    background-color: transparent;
    color: var(--text-muted);
}

.tab-btn.inactive:hover {
    color: var(--color-black);
}

.tab-btn:active {
    transform: scale(0.98);
}

/* Calculator Main Card Container */
.calculator-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

/* Section Header & Control Bar */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-black);
}

.section-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* Steppers */
.stepper-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stepper-btn {
    min-width: 36px;
    height: 36px;
    border: 2px solid var(--border-dark);
    background-color: var(--color-white);
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: all 0.15s ease;
}

.stepper-btn:active {
    transform: scale(0.92);
    background-color: var(--bg-subtle);
}

.number-input {
    width: 48px;
    height: 36px;
    text-align: center;
    border: 2px solid var(--border-dark);
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.95rem;
    font-family: var(--font-family);
    background-color: #ffffff;
    color: var(--color-black);
}

.presets-bar {
    display: flex;
    gap: 0.35rem;
    margin-left: 0.4rem;
}

.preset-chip {
    padding: 0.35rem 0.65rem;
    min-height: 32px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.15s ease;
    user-select: none;
}

.preset-chip:active {
    transform: scale(0.94);
    background-color: var(--color-black);
    color: var(--color-white);
}

/* Desktop Data Table */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

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

.data-table th {
    text-align: left;
    padding: 0.75rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-white);
    background-color: var(--color-black);
}

.data-table th:first-child {
    border-top-left-radius: var(--radius-sm);
}

.data-table th:last-child {
    border-top-right-radius: var(--radius-sm);
}

.data-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.subject-tag {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-black);
}

.mobile-field-label {
    display: none;
}

/* Custom Select & Text Inputs */
.credit-select, .grade-select, .text-input {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    background-color: var(--color-white);
    font-family: var(--font-family);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' 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: 14px;
    padding-right: 2.2rem;
}

.text-input {
    background-image: none;
    padding-right: 0.75rem;
}

.credit-select:focus, .grade-select:focus, .text-input:focus {
    border-color: var(--color-blue-border);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Result Box (Reference Style: Light Blue Card) */
.results-card {
    background-color: var(--bg-blue-tint);
    border: 2px solid var(--color-blue-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-main {
    display: flex;
    flex-direction: column;
}

.result-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.result-value {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--color-blue);
    line-height: 1.1;
    margin-top: 0.15rem;
}

.result-metrics {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-title {
    font-size: 0.725rem;
    color: var(--text-muted);
    font-weight: 700;
}

.metric-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.badge-percentage {
    background-color: var(--color-black);
    color: var(--color-white);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 800;
}

/* Action Button */
.btn-calc {
    width: 100%;
    min-height: 48px;
    margin-top: 1.1rem;
    padding: 0.75rem;
    background-color: var(--color-black);
    color: var(--color-white);
    border: 2px solid var(--color-black);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 800;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.btn-calc:active {
    transform: scale(0.98);
    background-color: #1f2937;
}

/* SEO, AEO, GEO & Educational Content Section */
.seo-article-section {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.seo-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
}

.seo-card h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-black);
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0.5rem;
}

.seo-card h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-black);
    margin: 1.25rem 0 0.4rem 0;
}

.seo-card p, .seo-card li {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.seo-card ul, .seo-card ol {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.formula-highlight {
    background-color: var(--bg-blue-tint);
    border-left: 4px solid var(--color-blue-border);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-black);
    margin: 0.75rem 0;
}

/* Affiliated Colleges Chips Grid */
.college-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.college-chip {
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
}

/* FAQ Accordions for AEO/LLMO */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
}

.faq-item {
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    overflow: hidden;
}

.faq-question {
    padding: 0.85rem 1.1rem;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--color-black);
    cursor: pointer;
    background-color: var(--bg-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-answer {
    padding: 1rem 1.1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    border-top: 1px solid var(--border-light);
    background-color: #ffffff;
}

/* Footer */
.app-footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.app-footer a {
    color: var(--color-black);
    font-weight: 800;
    text-decoration: underline;
}

/* Modal Dialog */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    background-color: var(--bg-card);
    border: 2px solid var(--color-black);
    border-radius: var(--radius-lg);
    max-width: 650px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-float);
    animation: modalPop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-black);
    background: var(--color-white);
    color: var(--color-black);
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ==========================================================================
   Android Mobile App Responsive Layout (max-width: 640px)
   ========================================================================== */
@media (max-width: 640px) {
    body {
        padding: 0.75rem 0.5rem 2rem 0.5rem;
    }

    .app-container {
        width: 100%;
    }

    .app-header {
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .brand-logo {
        width: 46px;
        height: 46px;
    }

    .brand-title h1 {
        font-size: 1.15rem;
    }

    .brand-subtitle {
        font-size: 0.75rem;
    }

    .btn-help-pill {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .calculator-card, .seo-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .stepper-control {
        width: 100%;
        justify-content: space-between;
    }

    .presets-bar {
        margin-left: 0;
    }

    /* Transform Table into Android List Cards */
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        background-color: var(--bg-subtle);
        border: 1.5px solid var(--border-dark);
        border-radius: var(--radius-md);
        padding: 0.85rem;
        margin-bottom: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .data-table td {
        padding: 0;
        border: none;
        width: 100% !important;
    }

    .subject-tag {
        font-size: 0.95rem;
        font-weight: 800;
        color: var(--color-black);
    }

    .mobile-field-label {
        display: block;
        font-size: 0.725rem;
        font-weight: 800;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 0.2rem;
    }

    /* Mobile Results Card */
    .results-card {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .result-main {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .result-value {
        font-size: 2.1rem;
    }

    .result-metrics {
        width: 100%;
        justify-content: space-between;
        padding-top: 0.6rem;
        border-top: 1px dashed var(--color-blue-border);
    }

    /* Android Bottom Sheet for Modal */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card {
        border-radius: 20px 20px 0 0;
        max-height: 80vh;
        padding: 1.5rem 1.25rem;
        animation: bottomSheetSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes bottomSheetSlide {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}
