/* =========================================
   Global Variables & Reset
========================================= */
:root {
    --primary-color: #4361EE; 
    --secondary-color: #F72585; 
    --bg-color: #F4F7FE; 
    --card-bg: #FFFFFF;
    --text-main: #2B2D42;
    --text-muted: #8D99AE;
    --border-radius: 20px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    
    /* Calculator Specific Colors */
    --calc-screen-bg: #1E293B;
    --calc-screen-text: #F8FAFC;
    --key-bg: #F8FAFC;
    --key-border: #E2E8F0;
    --key-sci: #E0E7FF;
    --key-op: #FFE4E6;
    --key-op-text: #E11D48;
}

body.dark-mode {
    --bg-color: #0F172A; 
    --card-bg: #1E293B; 
    --text-main: #F8FAFC; 
    --text-muted: #94A3B8; 
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); 
    
    /* Calculator Dark Mode */
    --calc-screen-bg: #0B1120;
    --key-bg: #334155;
    --key-border: #475569;
    --key-sci: #1E293B;
    --key-op: #4C1D95;
    --key-op-text: #DDD6FE;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   Navbar (Header)
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s ease;
}

.logo {
    font-size: 20px;
    font-weight: 800;
}

.highlight {
    color: var(--primary-color);
}

.theme-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.theme-btn:hover {
    transform: scale(1.2) rotate(15deg);
}

/* =========================================
   Main Tool Layout
========================================= */
.tool-container {
    display: flex;
    justify-content: center;
    padding: 40px 5%;
}

.tool-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: background-color 0.3s ease;
}

.card-header {
    margin-bottom: 10px;
}

.tool-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* =========================================
   Calculator UI
========================================= */
.calculator-wrapper {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(141, 153, 174, 0.2);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

/* Screen */
.calc-screen {
    background-color: var(--calc-screen-bg);
    color: var(--calc-screen-text);
    border-radius: 10px;
    padding: 20px;
    text-align: right;
    margin-bottom: 15px;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    overflow: hidden;
    word-wrap: break-word;
}

.calc-expression {
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    color: #94A3B8;
    min-height: 1.5rem;
    margin-bottom: 5px;
}

.calc-result {
    font-family: 'Fira Code', monospace;
    font-size: 2.2rem;
    font-weight: 500;
}

/* Angle Toggle (DEG / RAD) */
.angle-toggle-wrapper {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.angle-btn {
    background: transparent;
    border: 2px solid var(--key-border);
    color: var(--text-muted);
    padding: 5px 15px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Keypad Grid */
.calc-keys {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.key {
    background-color: var(--key-bg);
    color: var(--text-main);
    border: 1px solid var(--key-border);
    border-radius: 8px;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s, box-shadow 0.1s;
    user-select: none;
    box-shadow: 0 4px 0 var(--key-border);
}

.key:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--key-border);
}

/* Specific Key Styles */
.sci-key {
    background-color: var(--key-sci);
    font-size: 0.95rem;
}

.num-key {
    background-color: var(--card-bg);
    font-size: 1.2rem;
}

.op-key {
    background-color: var(--key-op);
    color: var(--key-op-text);
    font-size: 1.4rem;
}

.func-key {
    background-color: #ef476f;
    color: white;
    border-color: #d13054;
    box-shadow: 0 4px 0 #d13054;
}

.func-key:active {
    box-shadow: 0 0 0 #d13054;
}

.equal-key {
    background-color: var(--primary-color);
    color: white;
    border-color: #324edb;
    box-shadow: 0 4px 0 #324edb;
    font-size: 1.4rem;
}

.equal-key:active {
    box-shadow: 0 0 0 #324edb;
}

/* =========================================
   SEO Content & FAQ
========================================= */
.content-section {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s ease;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.content-section p, .content-section ul {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.content-section ul {
    padding-left: 20px;
}

.content-section li {
    margin-bottom: 8px;
}

.faq-item {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(141, 153, 174, 0.2);
    padding-bottom: 15px;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

footer {
    text-align: center;
    padding: 30px 5%;
    margin-top: 20px;
    color: var(--text-muted);
}

/* =========================================
   Mobile Responsiveness
========================================= */
@media (max-width: 500px) {
    .tool-card {
        padding: 20px 10px;
    }
    .calculator-wrapper {
        padding: 15px 10px;
    }
    .calc-keys {
        gap: 6px;
    }
    .key {
        padding: 12px 0;
        font-size: 0.95rem;
    }
    .num-key {
        font-size: 1.1rem;
    }
    .calc-result {
        font-size: 1.8rem;
    }
}

/* =========================================
   Cookie Consent Banner (Original PC, Compact Mobile)
========================================= */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px; /* Restored to original PC size */
    background: var(--card-bg);
    border-radius: var(--border-radius, 20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px 30px; /* Restored to original PC padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    border: 2px solid var(--primary-color);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

/* Hidden state for smooth animation */
.cookie-banner.hidden {
    transform: translate(-50%, 150px);
    opacity: 0;
    pointer-events: none;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cookie-icon {
    font-size: 35px; /* Restored to original PC size */
}

.cookie-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

.cookie-content a {
    color: var(--primary-color);
    font-weight: 800;
    text-decoration: underline;
}

.cookie-btn {
    background-color: var(--primary-color);
    padding: 12px 25px; /* Restored to original PC size */
    font-size: 1.05rem;
    width: auto;
    white-space: nowrap;
    margin-left: 20px;
}

/* =========================================
   Mobile Responsiveness (Micro Version)
========================================= */
@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px; /* Bare minimum top and bottom padding */
        bottom: 0; /* Flushes the banner to the absolute bottom of the screen */
        border-radius: 15px 15px 0 0; /* Rounded top, flat bottom to save space */
        border-bottom: none;
        width: 100%; /* Stretches edge-to-edge on mobile */
    }
   
    .cookie-content {
        flex-direction: row; /* Puts the emoji NEXT to the text to save a whole line of height! */
        align-items: flex-start;
        text-align: left;
        gap: 8px;
    }

    .cookie-icon {
        font-size: 18px; /* Micro emoji */
        margin-top: 2px;
    }

    .cookie-content p {
        font-size: 0.75rem; /* Smallest comfortable reading size */
        line-height: 1.2; /* Tightly packs the text lines together */
    }
   
    .cookie-btn {
        width: 100%;
        margin-left: 0;
        padding: 6px; /* Extremely thin button vertically */
        font-size: 0.85rem;
        border-radius: 8px;
    }
}