/* ========================================
   Position Size Calculator - Stylesheet
   Brand Guideline Compliant
   ======================================== */

/* ========== CSS Variables from Brand Guideline ========== */
:root {
    --royal-blue: #26269E;
    --cornflower-blue: #3771D3;
    --pure-blue: #43A7F9;
    --sky-blue: #8AD0FF;
    --light-blue: #CFEEFF;
    --black: #232323;
    --grey: #7F7F7F;
    --white: #FFFFFF;
    --gradient-primary: linear-gradient(135deg, #26269E 0%, #3771D3 50%, #43A7F9 100%);
    --gradient-light: linear-gradient(180deg, #CFEEFF 0%, #FFFFFF 100%);
    --font-primary: 'Prompt', sans-serif;
    --shadow-sm: 0 2px 8px rgba(38, 38, 158, 0.1);
    --shadow-md: 0 4px 20px rgba(38, 38, 158, 0.15);
    --shadow-lg: 0 8px 40px rgba(38, 38, 158, 0.2);
    --transition: all 0.3s ease;
}

/* ========== Reset & Base ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-primary);
    font-weight: 400;
    color: var(--black);
    line-height: 1.6;
    background: var(--gradient-light);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }

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

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--royal-blue);
}

/* ========== Header ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo img { height: 40px; }

.nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    font-weight: 500;
    color: var(--black);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.nav-links a:hover::after { width: 100%; }
.nav-links a:hover { color: var(--royal-blue); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
}

.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--royal-blue);
    transition: var(--transition);
    border-radius: 2px;
}

/* ========== Main Content ========== */
.page-content {
    padding-top: 100px;
    padding-bottom: 80px;
}

.page-header {
    text-align: center;
    margin-bottom: 48px;
}

.page-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 12px;
}

.page-header p {
    font-size: 1.125rem;
    color: var(--grey);
    max-width: 600px;
    margin: 0 auto;
}

.page-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(67, 167, 249, 0.1);
    color: var(--pure-blue);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 50px;
    margin-bottom: 20px;
}

/* ========== Calculator Card ========== */
.calc-card {
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    max-width: 680px;
    margin: 0 auto;
    overflow: hidden;
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-body {
    padding: 40px;
}

/* ========== Form Rows ========== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--black);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== Toggle Buttons ========== */
.toggle-group {
    display: inline-flex;
    background: #f0f0f0;
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
}

.toggle-btn {
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    background: transparent;
    color: var(--grey);
    transition: var(--transition);
}

.toggle-btn.active {
    background: var(--royal-blue);
    color: var(--white);
}

/* ========== Inputs & Selects ========== */
.form-control {
    width: 100%;
    padding: 14px 18px;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 500;
    color: var(--black);
    background: #f8f9fc;
    border: 2px solid transparent;
    border-radius: 14px;
    outline: none;
    transition: var(--transition);
    appearance: none;
}

.form-control:focus {
    border-color: var(--pure-blue);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(67, 167, 249, 0.15);
}

.form-control::placeholder {
    color: #b0b0b0;
    font-weight: 400;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237F7F7F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ========== SL Input Group ========== */
.sl-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sl-group {
    display: flex;
    flex-direction: column;
}

.sl-label {
    font-size: 0.8rem;
    color: var(--grey);
    margin-bottom: 6px;
    font-weight: 500;
}

/* ========== Calculate Button ========== */
.calc-btn {
    width: 100%;
    padding: 16px;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--white);
    background: var(--gradient-primary);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calc-btn:active {
    transform: translateY(0);
}

/* ========== Result Section ========== */
.result-section {
    margin-top: 32px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(38, 38, 158, 0.04) 0%, rgba(67, 167, 249, 0.06) 100%);
    border-radius: 16px;
    border: 1px solid rgba(38, 38, 158, 0.08);
    text-align: center;
}

.result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--grey);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.result-value-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--royal-blue);
    line-height: 1;
}

.result-unit {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cornflower-blue);
}

.copy-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(38, 38, 158, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--royal-blue);
}

.copy-btn:hover {
    background: rgba(38, 38, 158, 0.15);
}

.copy-btn.copied {
    background: #22c55e;
    color: white;
}

/* ========== Detail Breakdown ========== */
.result-details {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--white);
    border-radius: 10px;
    font-size: 0.85rem;
}

.detail-item .detail-key {
    color: var(--grey);
}

.detail-item .detail-val {
    font-weight: 600;
    color: var(--black);
}

/* ========== Error State ========== */
.form-control.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.error-msg {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 4px;
    display: none;
}

.form-control.error + .error-msg {
    display: block;
}

/* ========== Info Section ========== */
.info-section {
    max-width: 680px;
    margin: 48px auto 0;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.info-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    padding: 36px;
}

.info-card h3 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.formula-box {
    background: #f8f9fc;
    border-left: 4px solid var(--royal-blue);
    border-radius: 0 12px 12px 0;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.formula-box code {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--royal-blue);
    font-weight: 600;
}

.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-list li {
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--grey);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-list li::before {
    content: '';
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: var(--gradient-primary);
    border-radius: 50%;
    margin-top: 6px;
}

.info-list li strong {
    color: var(--black);
}

/* ========== Footer ========== */
.footer {
    background: linear-gradient(135deg, #1a1a6e 0%, #26269E 100%);
    padding: 32px 0;
    margin-top: 80px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-brand img { height: 32px; }

.footer p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
}

.footer a:hover { color: var(--white); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-toggle { display: flex; }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 24px;
        box-shadow: var(--shadow-md);
        gap: 16px;
    }

    .calc-body { padding: 24px; }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sl-inputs {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .result-details { grid-template-columns: 1fr; }

    .info-card { padding: 24px; }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}
