/* PSAT Score Calculator - Main Styles */

:root {
    --psat-primary: #1F3A5F;
    --psat-secondary: #1F3A5F;
    --psat-background: #FFFFFF;
    --psat-text: #2B2B2B;
    --psat-accent: #2ECC71;
    --psat-danger: #E74C3C;
    --psat-light-gray: #F5F5F5;
    --psat-border: #E0E0E0;
    --psat-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --psat-shadow-lg: 0 4px 16px rgba(31, 58, 95, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.psat-calculator-container {
    max-width: 700px;
    margin: 0 auto;
    background-color: var(--psat-background);
    padding: 14px 12px;
}

/* Grade Selector */
.psat-grade-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.psat-grade-btn {
    padding: 7px 12px;
    border: 2px solid var(--psat-primary);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background-color: var(--psat-background);
    color: var(--psat-primary);
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.psat-grade-btn:hover {
    border-color: var(--psat-primary);
    color: var(--psat-primary);
    background-color: var(--psat-background);
}

.psat-grade-btn:focus,
.psat-grade-btn:focus-visible {
    border-color: var(--psat-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(31, 58, 95, 0.2);
}

.psat-grade-btn:active {
    background-color: var(--psat-background);
    color: var(--psat-primary);
    border-color: var(--psat-primary);
}

.psat-grade-btn-active {
    background-color: var(--psat-primary);
    color: var(--psat-background);
    border-color: var(--psat-primary);
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(31, 58, 95, 0.2);
}

.psat-grade-btn-active:hover,
.psat-grade-btn-active:focus,
.psat-grade-btn-active:focus-visible,
.psat-grade-btn-active:active {
    background-color: var(--psat-primary);
    color: var(--psat-background);
    border-color: var(--psat-primary);
}

/* Header */
.psat-calculator-header {
    text-align: center;
    margin-bottom: 14px;
}

.psat-title {
    font-size: 1.5rem;
    color: var(--psat-primary);
    margin-bottom: 6px;
    font-weight: 700;
}

.psat-subtitle {
    font-size: 0.82rem;
    color: var(--psat-text);
    line-height: 1.5;
    opacity: 1;
    max-width: 700px;
    margin: 0 auto;
}

/* Form Styles */
.psat-calculator-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Sections */
.psat-section {
    background-color: var(--psat-light-gray);
    border-radius: 10px;
    padding: 10px 12px;
    border: 2px solid var(--psat-border);
}

.psat-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.psat-section-title {
    font-size: 0.95rem;
    color: var(--psat-primary);
    font-weight: 600;
    flex: 1;
    min-width: 160px;
}

.psat-section-progress {
    font-size: 0.85rem;
    color: var(--psat-primary);
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.psat-section-reset {
    padding: 4px 10px;
    font-size: 0.78rem;
}

/* Modules */
.psat-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.psat-module {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.psat-module-label {
    font-size: 0.85rem;
    color: var(--psat-text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.psat-module-range {
    font-size: 0.78rem;
    color: var(--psat-text);
    opacity: 0.8;
    font-weight: 400;
}

/* Range Slider Styles */
.psat-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--psat-secondary) 0%, var(--psat-secondary) var(--slider-value), var(--psat-border) var(--slider-value), var(--psat-border) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.psat-slider:hover {
    background: linear-gradient(to right, var(--psat-primary) 0%, var(--psat-primary) var(--slider-value), var(--psat-border) var(--slider-value), var(--psat-border) 100%);
    box-shadow: 0 0 6px rgba(31, 58, 95, 0.25);
}

.psat-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--psat-primary) 0%, var(--psat-secondary) 100%);
    cursor: grab;
    box-shadow: 0 2px 6px rgba(31, 58, 95, 0.3);
    border: 2px solid var(--psat-background);
    transition: all 0.2s ease;
}

.psat-slider::-webkit-slider-thumb:hover {
    width: 20px;
    height: 20px;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(31, 58, 95, 0.5);
}

.psat-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    box-shadow: 0 6px 16px rgba(31, 58, 95, 0.6);
    width: 22px;
    height: 22px;
}

.psat-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--psat-primary) 0%, var(--psat-secondary) 100%);
    cursor: grab;
    box-shadow: 0 2px 6px rgba(31, 58, 95, 0.3);
    border: 2px solid var(--psat-background);
    transition: all 0.2s ease;
}

.psat-slider::-moz-range-thumb:hover {
    width: 20px;
    height: 20px;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(31, 58, 95, 0.5);
}

.psat-slider::-moz-range-thumb:active {
    cursor: grabbing;
    box-shadow: 0 6px 16px rgba(31, 58, 95, 0.6);
    width: 22px;
    height: 22px;
}

.psat-slider::-moz-range-track {
    background: transparent;
    border: none;
}

.psat-slider::-moz-range-progress {
    background: var(--psat-secondary);
    border-radius: 5px;
    height: 6px;
}

/* Input Wrapper */
.psat-input-wrapper {
    display: flex;
    gap: 8px;
    position: relative;
}

.psat-btn-arrow {
    padding: 4px 6px;
    border: 1px solid var(--psat-secondary);
    background-color: var(--psat-background);
    color: var(--psat-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.psat-btn-arrow:hover {
    background-color: var(--psat-secondary);
    color: var(--psat-background);
    border-color: var(--psat-secondary);
}

.psat-btn-arrow:focus,
.psat-btn-arrow:focus-visible {
    outline: none;
    background-color: var(--psat-background);
    color: var(--psat-primary);
    border-color: var(--psat-secondary);
    box-shadow: none;
}

.psat-btn-arrow:active {
    transform: scale(0.95);
    background-color: var(--psat-background);
    color: var(--psat-primary);
    border-color: var(--psat-secondary);
    outline: none;
    box-shadow: none;
}

.psat-input {
    flex: 1;
    padding: 6px 10px 6px 20px;
    border: 2px solid var(--psat-secondary);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--psat-text);
    background-color: var(--psat-background);
    transition: all 0.3s ease;
    font-weight: 500;
    cursor: grab;
    position: relative;
    background-image: 
        linear-gradient(to right, var(--psat-secondary) 0%, var(--psat-secondary) 12px, transparent 12px, transparent calc(100% - 12px), var(--psat-secondary) calc(100% - 12px), var(--psat-secondary) 100%),
        linear-gradient(to bottom, transparent 0%, transparent 40%, var(--psat-secondary) 40%, var(--psat-secondary) 44%, transparent 44%, transparent 56%, var(--psat-secondary) 56%, var(--psat-secondary) 60%, transparent 60%, transparent 100%);
    background-repeat: no-repeat, repeat-x;
    background-size: 100% 4px, 4px 100%;
    background-position: 0 12px, 12px center;
}

.psat-input::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: var(--psat-primary);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(31, 58, 95, 0.3);
    cursor: grab;
}

.psat-input:active::before {
    width: 16px;
    height: 16px;
    left: 10px;
    box-shadow: 0 3px 8px rgba(31, 58, 95, 0.5);
    background-color: var(--psat-primary);
    cursor: grabbing;
}

.psat-input:active {
    cursor: grabbing;
    background-color: rgba(77, 163, 255, 0.08);
    border-color: var(--psat-primary);
    box-shadow: inset 0 0 6px rgba(77, 163, 255, 0.15);
}

.psat-input:focus {
    outline: none;
    border-color: var(--psat-primary);
    box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.1);
}

.psat-input:hover {
    border-color: var(--psat-primary);
    opacity: 0.95;
}

.psat-input:hover::before {
    width: 14px;
    height: 14px;
    left: 11px;
    box-shadow: 0 2px 6px rgba(31, 58, 95, 0.4);
}

.psat-input::placeholder {
    color: var(--psat-text);
    opacity: 0.6;
}

.psat-input-suffix {
    font-size: 0.82rem;
    color: var(--psat-text);
    opacity: 0.85;
    min-width: 70px;
    font-weight: 500;
}

/* Buttons */
.psat-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.psat-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--psat-shadow-lg);
}

.psat-btn:active {
    transform: translateY(0);
}

.psat-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.psat-btn-primary {
    background-color: var(--psat-primary);
    color: var(--psat-background);
    flex: 1;
}

.psat-btn-primary:hover {
    background-color: #152A4F;
}

.psat-btn-danger {
    background-color: var(--psat-danger);
    color: var(--psat-background);
    flex: 1;
}

.psat-btn-danger:hover {
    background-color: #C0392B;
}

.psat-btn-success {
    background-color: var(--psat-accent);
    color: var(--psat-background);
    flex: 1;
    font-weight: 700;
}

.psat-btn-success:hover {
    background-color: #27AE60;
    transform: translateY(-2px);
    box-shadow: var(--psat-shadow-lg);
}

.psat-btn-reset {
    background-color: var(--psat-secondary);
    color: var(--psat-background);
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
}

.psat-btn-reset:hover {
    background-color: #2E92E6;
    color: var(--psat-background);
}

.psat-section-reset {
    background-color: var(--psat-danger);
    color: var(--psat-background);
}

.psat-section-reset:hover {
    background-color: #C0392B;
}

/* Action Buttons */
.psat-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

/* Results Section */
.psat-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.psat-score-display {
    background: linear-gradient(135deg, var(--psat-primary) 0%, #2B4F7F 100%);
    border-radius: 10px;
    padding: 12px;
    color: var(--psat-background);
    box-shadow: var(--psat-shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.psat-score-main {
    margin-bottom: 8px;
}

.psat-score-label {
    font-size: 0.78rem;
    opacity: 1;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.psat-score-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--psat-accent);
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.psat-score-hint {
    font-size: 0.72rem;
    opacity: 0.95;
    margin-top: 6px;
}

.psat-perfect-score {
    font-size: 0.8rem;
    opacity: 0.92;
    margin-top: 15px;
    font-style: italic;
}

.psat-perfect-note {
    font-size: 0.75rem;
    opacity: 0.92;
    display: block;
    margin-top: 6px;
    font-style: italic;
}

.psat-score-breakdown {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.psat-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.psat-score-item-label {
    font-size: 0.8rem;
    opacity: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.psat-score-item-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--psat-accent);
}

/* National Merit Selection Index */
.psat-nms-index {
    background: linear-gradient(135deg, var(--psat-secondary) 0%, #2E92E6 100%);
    border-radius: 10px;
    padding: 12px;
    color: var(--psat-background);
    box-shadow: var(--psat-shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.psat-nms-label {
    font-size: 0.78rem;
    opacity: 1;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.psat-nms-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--psat-accent);
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.psat-nms-level {
    font-size: 0.8rem;
    opacity: 0.98;
    line-height: 1.5;
    font-weight: 600;
    max-width: 250px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .psat-calculator-container {
        padding: 30px 15px;
    }

    .psat-grade-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .psat-grade-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .psat-title {
        font-size: 2rem;
    }

    .psat-subtitle {
        font-size: 0.95rem;
    }

    .psat-input {
        background-size: 100% 3px, 3px 100%;
        background-position: 0 12px, 12px center;
    }

    .psat-input::before {
        width: 12px;
        height: 12px;
        left: 12px;
    }

    .psat-input:active::before {
        width: 15px;
        height: 15px;
        left: 10px;
    }

    .psat-input:hover::before {
        width: 14px;
        height: 14px;
        left: 11px;
    }

    .psat-section {
        padding: 20px;
    }

    .psat-modules {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .psat-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .psat-action-buttons {
        grid-template-columns: 1fr;
    }

    .psat-results {
        grid-template-columns: 1fr;
    }

    .psat-score-value {
        font-size: 3rem;
    }

    .psat-nms-value {
        font-size: 2.5rem;
    }

    .psat-score-item-value {
        font-size: 1.5rem;
    }

    .psat-slider {
        height: 7px;
        margin-top: 12px;
    }

    .psat-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    .psat-slider::-webkit-slider-thumb:hover {
        width: 24px;
        height: 24px;
    }

    .psat-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    .psat-slider::-moz-range-thumb:hover {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .psat-calculator-container {
        padding: 20px 10px;
    }

    .psat-grade-selector {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 30px;
    }

    .psat-grade-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .psat-title {
        font-size: 1.5rem;
    }

    .psat-subtitle {
        font-size: 0.9rem;
    }

    .psat-section {
        padding: 15px;
    }

    .psat-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .psat-input {
        padding: 10px 12px 10px 24px;
        font-size: 0.95rem;
        background-size: 100% 3px, 3px 100%;
        background-position: 0 10px, 10px center;
    }

    .psat-input::before {
        width: 10px;
        height: 10px;
        left: 13px;
    }

    .psat-input:active::before {
        width: 14px;
        height: 14px;
        left: 11px;
    }

    .psat-input:hover::before {
        width: 12px;
        height: 12px;
        left: 12px;
    }

    .psat-score-value {
        font-size: 2.5rem;
    }

    .psat-nms-value {
        font-size: 2rem;
    }

    .psat-score-breakdown {
        flex-direction: column;
        gap: 15px;
    }

    .psat-slider {
        height: 6px;
        margin-top: 12px;
    }

    .psat-slider::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    .psat-slider::-webkit-slider-thumb:hover {
        width: 22px;
        height: 22px;
    }

    .psat-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    .psat-slider::-moz-range-thumb:hover {
        width: 22px;
        height: 22px;
    }
}

/* Input number spinner hide */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.psat-score-value {
    animation: pulse 0.5s ease-in-out;
}

/* Utility Classes */
.psat-hidden {
    display: none !important;
}

.psat-visible {
    display: block !important;
}
