/* Scientific Calculator Australia - Styles */
/* Modern, accessible design optimised for Australian users */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;

    /* Secondary Colors */
    --secondary-color: #059669;
    --secondary-dark: #047857;

    /* Neutrals */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    /* Calculator Colors */
    --calc-bg: #1e293b;
    --calc-display-bg: #0f172a;
    --btn-number: #334155;
    --btn-number-hover: #475569;
    --btn-operator: #2563eb;
    --btn-operator-hover: #1d4ed8;
    --btn-function: #475569;
    --btn-function-hover: #64748b;
    --btn-equals: #059669;
    --btn-equals-hover: #047857;
    --btn-clear: #dc2626;
    --btn-clear-hover: #b91c1c;
    --btn-memory: #7c3aed;
    --btn-memory-hover: #6d28d9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: all 0.2s ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 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: 0;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

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

.nav-badge {
    background: var(--secondary-color);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.nav-location {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Main Content */
.main {
    flex: 1;
    padding: 40px 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 12px;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator Section */
.calculator-section {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

/* Calculator */
.calculator {
    background: var(--calc-bg);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

/* Display */
.display-container {
    background: var(--calc-display-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.expression {
    color: #94a3b8;
    font-size: 0.95rem;
    min-height: 24px;
    text-align: right;
    word-break: break-all;
    margin-bottom: 8px;
}

.display {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
    text-align: right;
    font-family: 'SF Mono', 'Consolas', monospace;
    outline: none;
}

.display::selection {
    background: var(--primary-color);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: var(--btn-function);
    color: #94a3b8;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
}

.mode-btn:hover {
    opacity: 0.9;
}

.memory-indicator {
    margin-left: auto;
    color: var(--btn-memory);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Buttons Grid */
.buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.btn {
    padding: 16px 8px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.95);
}

.btn:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Button Types */
.btn-number {
    background: var(--btn-number);
    font-size: 1.25rem;
}

.btn-number:hover {
    background: var(--btn-number-hover);
}

.btn-operator {
    background: var(--btn-operator);
}

.btn-operator:hover {
    background: var(--btn-operator-hover);
}

.btn-function {
    background: var(--btn-function);
    font-size: 0.9rem;
}

.btn-function:hover {
    background: var(--btn-function-hover);
}

.btn-equals {
    background: var(--btn-equals);
    grid-column: span 2;
    font-size: 1.5rem;
}

.btn-equals:hover {
    background: var(--btn-equals-hover);
}

.btn-clear {
    background: var(--btn-clear);
}

.btn-clear:hover {
    background: var(--btn-clear-hover);
}

.btn-memory {
    background: var(--btn-memory);
    font-size: 0.85rem;
}

.btn-memory:hover {
    background: var(--btn-memory-hover);
}

/* History Panel */
.history-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 300px;
    border: 1px solid var(--border-color);
}

.history-panel h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-color);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.history-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

.history-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-color);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--border-color);
}

.history-expression {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
}

.history-result {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.clear-history-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.clear-history-btn:hover {
    background: var(--bg-color);
    color: var(--btn-clear);
    border-color: var(--btn-clear);
}

/* Features Section */
.features {
    margin-bottom: 60px;
}

.features h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* How to Use Section */
.how-to-use {
    margin-bottom: 60px;
}

.how-to-use h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 32px;
}

.instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.instruction-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step {
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.instruction-item h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.instruction-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* SEO Content Section */
.seo-content {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.seo-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-color);
}

.seo-text h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text-color);
}

.seo-text p {
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.8;
}

.seo-text strong {
    color: var(--text-color);
}

/* Footer */
.footer {
    background: var(--calc-bg);
    color: white;
    padding: 40px 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-brand .logo-icon {
    color: var(--primary-light);
}

.footer-tagline {
    color: #94a3b8;
    font-size: 0.95rem;
}

.footer-links {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.footer-links p {
    margin-bottom: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 12px;
    }

    .hero h2 {
        font-size: 1.75rem;
    }

    .calculator-section {
        flex-direction: column;
        align-items: center;
    }

    .calculator {
        max-width: 100%;
    }

    .history-panel {
        max-width: 100%;
    }

    .buttons {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }

    .btn {
        padding: 14px 4px;
        font-size: 0.9rem;
    }

    .btn-number {
        font-size: 1.1rem;
    }

    .btn-function {
        font-size: 0.75rem;
    }

    .btn-memory {
        font-size: 0.7rem;
    }

    .display {
        font-size: 2rem;
    }

    .seo-content {
        padding: 32px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .nav-badge {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .calculator {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .display-container {
        padding: 16px;
    }

    .display {
        font-size: 1.75rem;
    }

    .buttons {
        gap: 4px;
    }

    .btn {
        padding: 12px 2px;
        font-size: 0.8rem;
        border-radius: var(--radius-sm);
    }

    .btn-number {
        font-size: 1rem;
    }

    .btn-function {
        font-size: 0.65rem;
    }

    .btn-memory {
        font-size: 0.6rem;
    }

    .btn-equals {
        font-size: 1.25rem;
    }

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

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --btn-number: #1e293b;
        --btn-function: #334155;
    }

    .btn {
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles */
@media print {
    .header,
    .calculator-section,
    .footer {
        display: none;
    }

    .seo-content {
        box-shadow: none;
        border: none;
    }
}
