:root {
    /* Primary Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-hover: #1d4ed8;
    --primary-shadow: rgb(37 99 235 / 25%);
    
    /* Legacy Primary (for backward compatibility) */
    --primary-color: var(--primary);
    --primary-color-light: var(--primary-light);
    
    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --accent: #36cfc9;
    
    /* Legacy Semantic (for backward compatibility) */
    --success-color: var(--success);
    --warning-color: var(--warning);
    --danger-color: var(--danger);
    
    /* Surface Colors */
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --surface-elevated: #ffffff;
    --background: #f8fafc;
    
    /* Legacy Surface (for backward compatibility) */
    --surface-color: var(--surface);
    --light-bg: var(--background);
    --secondary-bg: #e2e8f0;
    
    /* Border Colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    
    /* Legacy Border (for backward compatibility) */
    --border-color: var(--border);
    
    /* Text Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Legacy Text (for backward compatibility) */
    --text-primary: var(--text-main);
    --text-secondary: var(--text-muted);
    --secondary-color: #334155;
    
    /* Shadow System */
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.08);
    --shadow-md: 0 4px 12px rgb(15 23 42 / 0.08);
    --shadow-lg: 0 12px 24px rgb(15 23 42 / 0.12);
    --shadow-xl: 0 20px 25px rgb(15 23 42 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Layout */
    --max-width-reading: 720px;
    --max-width-content: 1200px;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    
    /* Determinant Calculator Variables */
    --det-primary: #2563eb;
    --det-primary-dark: #1d4ed8;
    --det-accent: #0ea5e9;
    --det-surface: #ffffff;
    --det-border: #e2e8f0;
    --det-text: #0f172a;
    --det-muted: #64748b;
    --det-success: #22c55e;
    --det-radius-lg: 1.5rem;
    --det-radius-md: 1rem;
    --det-radius-sm: 0.75rem;
    --det-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
    --det-shadow-lg: 0 30px 60px rgba(37, 99, 235, 0.12);
}

.determinant-calculator-page {
    padding: 2rem 0;
}

.calculator-intro {
    margin-bottom: 3rem;
}

.calculator-title {
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.1;
}

.calculator-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    max-width: 860px;
    line-height: 1.6;
}

.calculator-meta {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
}

.meta-chip {
    background: var(--surface-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.calculator-main {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.calculator-card {
    padding: 0rem 2rem;
    height: 100%;
}

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.label-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.calculator-input,
.calculator-select {
    width: 100%;
    padding: 1rem 1.15rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    background: var(--surface-color);
    box-shadow: inset 0 1px 2px rgb(15 23 42 / 0.04);
}

.calculator-input:focus,
.calculator-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

.calculator-input::placeholder {
    color: var(--text-light);
}

/* Matrix Input Grid */
.matrix-input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

.matrix-grid {
    display: grid;
    gap: 0.75rem;
    justify-content: center;
    padding: 1rem;
    background: var(--surface-color);
    border-radius: var(--radius-sm);
}

.matrix-grid.matrix-2x2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 200px;
    margin: 0 auto;
}

.matrix-grid.matrix-3x3 {
    grid-template-columns: repeat(3, 1fr);
    max-width: 300px;
    margin: 0 auto;
}

.matrix-grid.matrix-4x4 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 400px;
    margin: 0 auto;
}

.matrix-cell {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    text-align: center;
    background: var(--surface-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-weight: 600;
}

.matrix-cell:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-shadow);
    transform: scale(1.05);
}

.matrix-cell:hover {
    border-color: var(--primary-color);
}

/* Example Buttons */
.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.example-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
}

.example-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.status-info {
    background: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.status-bar svg {
    flex-shrink: 0;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-trigger {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.tooltip-trigger:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

.tooltiptext {
    visibility: hidden;
    opacity: 0;
    width: 240px;
    background: var(--text-primary);
    color: var(--text-inverse);
    text-align: left;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -120px;
    font-size: 0.875rem;
    line-height: 1.5;
    transition: opacity 0.3s;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-primary) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.calculate-btn {
    flex: 1;
    min-width: 200px;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

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

.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ghost-btn {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ghost-btn:hover {
    border-color: var(--text-primary);
    background: var(--background);
    transform: translateY(-2px);
}

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

/* Results Container */
.results-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid rgba(148, 163, 184, 0.25);
    height: 100%;
}

.results-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.results-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-value-container {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-light);
}

.result-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.result-value {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--primary-color);
    margin: 0.5rem 0;
    
}

.result-status {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--surface-color);
    border-radius: 0.5rem;
    display: inline-block;
}

.result-status.singular {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.result-status.invertible {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

/* Matrix Display */
.matrix-display {
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    
    text-align: center;
    overflow-x: auto;
}

.matrix-display-content {
    display: inline-block;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Properties Container */
.properties-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.property-label {
    font-weight: 600;
    color: var(--text-primary);
}

.property-value {
    font-weight: 700;
    color: var(--primary-color);
    
}

.property-value.yes {
    color: var(--success-color);
}

.property-value.no {
    color: var(--text-secondary);
}

/* Steps Container */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-item {
    padding: 1.25rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.step-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.step-content {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    
}

/* Copy and Share Buttons */
.result-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.copy-buttons-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.copy-buttons-row .copy-button {
    flex: 1 1 auto;
    min-width: 140px;
}

.copy-button {
    width: 48%;
    background: #f1f5f9;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #405063 !important;
    border: 1px solid #dde3e7;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    text-decoration: none;
}

.copy-button:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.copy-button.copied {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff !important;
}

.share-container {
    background: rgba(241, 245, 249, 0.8);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.share-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.2);
    color: #ffffff;
}

.share-x {
    background: #111827;
}

.share-facebook {
    background: #1877f2;
}

.share-linkedin {
    background: #0a66c2;
}

.share-reddit {
    background: #ff4500;
}

.share-telegram {
    background: #229ed9;
}

.share-whatsapp {
    background: #25d366;
}

/* Educational Content Section */
.angle-seo-section {
    margin: 4rem 0;
    padding: 3rem 0;
    background: var(--background);
}

.angle-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.angle-education-card h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.angle-education-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.angle-education-card p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.angle-education-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.angle-education-card a:hover {
    border-bottom-color: var(--primary-color);
}

/* Infographic Styles */
.infographic-timeline {
    margin: 2.5rem 0;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.infographic-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
}

.timeline-container {
    position: relative;
}

.timeline-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    position: relative;
}

.timeline-item {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.timeline-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.timeline-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.timeline-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.timeline-era {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.timeline-years {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.timeline-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.infographic-conversion-formula {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.formula-box {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.formula-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.formula-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.formula-content {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    
    margin-bottom: 0.75rem;
}

.formula-example {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .determinant-calculator-page {
        padding: 1rem 0;
    }

    .calculator-card {
        padding: 0rem 1rem;
    }

    .calculator-main {
        padding: 1.5rem;
    }

    .matrix-grid.matrix-2x2,
    .matrix-grid.matrix-3x3,
    .matrix-grid.matrix-4x4 {
        max-width: 100%;
    }

    .matrix-cell {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .calculate-btn,
    .ghost-btn {
        width: 100%;
        min-width: 100%;
    }

    .copy-buttons-row {
        flex-direction: column;
    }

    .copy-buttons-row .copy-button {
        width: 100%;
    }

    .share-buttons {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .timeline-items {
        grid-template-columns: 1fr;
    }

    .infographic-conversion-formula {
        grid-template-columns: 1fr;
    }

    .angle-card {
        padding: 1.5rem;
    }

    .tooltiptext {
        width: 200px;
        margin-left: -100px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .calculator-title {
        font-size: 1.75rem;
    }

    .calculator-subtitle {
        font-size: 1rem;
    }

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

    .example-buttons {
        flex-direction: column;
    }

    .example-btn {
        width: 100%;
    }
}

