/* calculator.css - Styles for mathematical utility calculators */

/* ============================================
   CALCULATOR CONTAINER & LAYOUT
   ============================================ */

.calculator-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   FORMULA BOX
   ============================================ */

.formula-box {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    color: #333;
}

.formula-box code {
    font-size: 16px;
    font-weight: bold;
    color: #1976d2;
    display: block;
    margin: 5px 0;
}

.formula-box strong {
    color: #333;
}

.formula-box p {
    margin: 10px 0 0 0;
    color: #333;
}

/* ============================================
   FORMS
   ============================================ */

.calculator-container form {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calculator-container form label {
    font-weight: bold;
    display: block;
    margin-top: 15px;
    color: #333;
}

.calculator-container form select,
.calculator-container form input[type="number"] {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.calculator-container form input[type="submit"] {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.calculator-container form input[type="submit"]:hover {
    background: #1565c0;
}

.calculator-container form p {
    color: #333;
}

/* Input Groups */
.input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

/* ============================================
   RESULTS CONTAINER
   ============================================ */

.result-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e0e0e0;
}

.result-container h2,
.result-container h3 {
    color: #333;
}

.result-container p {
    color: #666;
}

.result-container.error {
    border-color: #f44336;
}

.result-container.error p {
    color: #f44336;
}

/* Result Grid */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.result-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #1976d2;
}

.result-label {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.result-value {
    font-size: 20px;
    font-weight: bold;
    color: #1976d2;
    margin-top: 5px;
}

.result-value.highlight {
    font-size: 28px;
    color: #d32f2f;
}

/* ============================================
   DIAGRAM CONTAINER
   ============================================ */

.diagram-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.diagram-container h3 {
    text-align: center;
    color: #333;
}

.diagram-container p {
    text-align: center;
    color: #666;
    margin-top: 15px;
}

.diagram-container p em {
    color: #666;
}

.diagram-container svg {
    max-width: 700px;
    margin: 20px auto;
    display: block;
}

/* ============================================
   ABOUT THIS TOOL BOX
   ============================================ */

.about-tool-box {
    margin-top: 30px;
    padding: 20px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    color: #333;
}

.about-tool-box h3 {
    margin-top: 0;
    color: #333;
}

.about-tool-box p {
    color: #333;
}

.about-tool-box ul {
    color: #333;
}

.about-tool-box li {
    color: #333;
}

/* ============================================
   SHAPE SELECTOR (for volume calculator)
   ============================================ */

.shape-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.shape-btn {
    padding: 15px;
    background: #e3f2fd;
    border: 2px solid #1976d2;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
}

.shape-btn:hover {
    background: #1976d2;
    color: white;
}

.shape-btn.active {
    background: #1976d2;
    color: white;
}

/* ============================================
   CALC TYPE SELECTOR (for percentage calculator)
   ============================================ */

.calc-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.calc-type-btn {
    padding: 15px;
    background: #e3f2fd;
    border: 2px solid #1976d2;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
}

.calc-type-btn:hover {
    background: #1976d2;
    color: white;
}

/* ============================================
   TABLES (for compound interest breakdown)
   ============================================ */

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

.calculator-container table th {
    padding: 10px;
    text-align: left;
    background: #e3f2fd;
    color: #333;
    font-weight: bold;
}

.calculator-container table th:not(:first-child) {
    text-align: right;
}

.calculator-container table td {
    padding: 10px;
    color: #333;
}

.calculator-container table td:not(:first-child) {
    text-align: right;
}

.calculator-container table tr:nth-child(even) {
    background: #f8f9fa;
}

.calculator-container table tr:nth-child(odd) {
    background: white;
}

.calculator-container table .interest-earned {
    color: #2e7d32;
    font-weight: bold;
}

/* Scrollable table container */
.table-scroll-container {
    max-height: 300px;
    overflow-y: auto;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .calculator-container {
        padding: 10px;
    }

    .calculator-container form {
        padding: 15px;
    }

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

    .input-group {
        grid-template-columns: 1fr;
    }

    .shape-selector,
    .calc-type-selector {
        grid-template-columns: 1fr;
    }

    .formula-box code {
        font-size: 14px;
    }

    .result-value {
        font-size: 18px;
    }

    .result-value.highlight {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .calculator-container {
        max-width: 100%;
        padding: 5px;
    }

    .formula-box {
        padding: 10px;
    }

    .result-container,
    .diagram-container,
    .about-tool-box {
        padding: 15px;
    }
}

/* ============================================
   RESULT TEXT STYLES
   ============================================ */

.result-explanation {
    text-align: center;
    font-size: 18px;
    color: #666;
    margin: 15px 0;
}

.result-proof {
    text-align: center;
    margin-top: 15px;
    font-size: 18px;
    color: #333;
}

.result-note {
    color: #666;
    text-align: center;
    margin: 10px 0;
}

/* ============================================
   TABLE STYLES
   ============================================ */

.result-table-container {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

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

.result-table thead th {
    background: #e3f2fd;
    padding: 10px;
    text-align: left;
    color: #333;
    font-weight: bold;
    position: sticky;
    top: 0;
}

.result-table thead th.text-right {
    text-align: right;
}

.result-table tbody td {
    padding: 10px;
    color: #333;
}

.result-table tbody td.text-right {
    text-align: right;
}

.result-table tbody td.text-center {
    text-align: center;
}

.result-table tbody td.interest-value {
    color: #2e7d32;
    font-weight: bold;
}

.result-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.result-table tbody tr:nth-child(odd) {
    background: white;
}

.result-table tbody tr.note-row td {
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Ensure focus states are visible */
.calculator-container form input:focus,
.calculator-container form select:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Ensure all text meets contrast requirements */
.calculator-container {
    color: #333;
}

/* Error states with good contrast */
.calculator-container .error strong {
    color: #f44336;
}

/* ============================================
   VIDEO REFERENCE BOX
   ============================================ */

.video-reference-box {
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 2px solid #ff0000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-reference-box h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #ff0000;
    padding-bottom: 10px;
}

.video-container {
    margin-top: 15px;
}

.video-container a {
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s;
    align-items: flex-start;
}

.video-container a:hover {
    transform: translateY(-3px);
}

.video-thumbnail {
    width: 240px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.video-info {
    flex: 1;
}

.video-info h4 {
    margin: 0 0 10px 0;
    color: #1976d2;
    font-size: 18px;
}

.video-info p {
    margin: 0 0 10px 0;
    color: #666;
}

.video-link {
    color: #ff0000;
    font-weight: bold;
}

.video-container a:hover .video-link {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .video-container a {
        flex-direction: column;
    }

    .video-thumbnail {
        width: 100%;
        height: auto;
    }
}

/* ============================================
   ARCHAIC UNITS TABLE
   ============================================ */

.archaic-units-table {
    overflow-x: auto;
    margin: 15px 0;
}

.result-table tr.archaic-row {
    background: #e3f2fd !important;
}

.result-table tr.archaic-row td {
    font-style: italic;
}

/* ============================================
   £SD CURRENCY DISPLAY
   ============================================ */

.lsd-display {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    color: #1976d2;
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 3px solid #1976d2;
    font-family: 'Courier New', monospace;
}

/* ============================================
   YEAR LIST (for calendar reuse)
   ============================================ */

.year-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.year-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 2px solid #1976d2;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
}

.year-item:hover {
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.year-number {
    display: block;
    font-size: 24px;
    color: #1976d2;
}

.year-diff {
    display: block;
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .calculator-container form {
        display: none;
    }

    .about-tool-box {
        page-break-before: always;
    }

    .diagram-container svg {
        max-width: 100%;
    }
}
