/*
 * Custom styles for the Ultimate Calculator Hub recreated using the
 * provided templates.  This stylesheet borrows heavily from the
 * vibrant, glass‑morphism aesthetic of the supplied templates.  It
 * defines a collection of CSS variables for colour themes and
 * gradients, base resets, and component styles for the site
 * including the header, hero section, category grid and
 * individual calculator cards.  Responsiveness and subtle
 * animations are included to enhance the modern feel.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colour palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #f59e0b;
    --accent: #10b981;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --light: #f8fafc;
    --white: #ffffff;
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    /* Glass effects */
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-dark: rgba(15, 23, 42, 0.8);
    /* Shadows */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: var(--dark);
    color: var(--white);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Animated radial background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 70%, rgba(120, 119, 198, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 25s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    33% { transform: scale(1.05) rotate(1deg); opacity: 1; }
    66% { transform: scale(0.95) rotate(-1deg); opacity: 0.9; }
}

/* Header styles */
header {
    background: var(--glass-dark);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoGlow 3s ease-in-out infinite;

    /* Remove underline on the logo link */
    text-decoration: none;
}

@keyframes logoGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

nav a:hover {
    background: var(--glass);
    transform: translateY(-2px);
}

nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

nav a:hover::before {
    left: 100%;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #667eea 50%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: heroText 1.5s ease-out;
}

.hero p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto;
    animation: heroText 1.5s ease-out 0.2s both;
}

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

/* Categories grid */
.categories-section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.category-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    text-decoration: none;
    color: var(--white);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.category-card:hover::before {
    opacity: 0.1;
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-large);
    border-color: rgba(99, 102, 241, 0.5);
}

.category-icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    transition: all 0.3s ease;
}

.category-card:hover .category-icon {
    transform: rotate(10deg) scale(1.05);
    background: var(--gradient-secondary);
}

.category-card h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    transition: color 0.3s ease;
}

.category-card:hover h2 {
    color: #f59e0b;
}

.category-card p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    transition: color 0.3s ease;
}

.category-card:hover p {
    color: rgba(255, 255, 255, 0.9);
}

/* Category page layout */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
}

.calculators-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.quick-nav {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
}

.quick-nav h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quick-nav a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.quick-nav a:hover {
    background: var(--glass);
}

/* Calculator card */
.calculator {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.calculator:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-medium);
}

.calculator h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calculator h3 .icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    font-size: 1.2rem;
}

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

.calculator input,
/*
 * Style drop‑down <select> elements consistently with the rest of the UI.
 * Without overriding the default <option> styles many browsers render a white
 * background with white text, making selections invisible.  Here we set a
 * dark background and white text for both the <select> control and its
 * options so that the dropdown remains legible across themes.
 */
.calculator select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background-color: var(--dark-light);
    color: var(--white);
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

/* Style the individual options inside the select to ensure text is visible.
 * Setting a dark background and light text solves the issue where options
 * rendered with white text on a white background were unreadable until
 * selected.
 */
.calculator select option {
    background-color: var(--dark-light);
    color: var(--white);
}

.calculator input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Make date picker icon white for better visibility on dark backgrounds */
.calculator input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.calculator button {
    align-self: flex-start;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--white);
    background: var(--gradient-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.calculator button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.result {
    margin-top: 0.5rem;
    font-weight: 500;
    color: var(--accent);
}

/* Basic calculator styles */
.basic-calc-section {
    padding: 2rem 2rem;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.basic-calculator {
    background: var(--glass-dark);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.basic-calculator input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 1.5rem;
    text-align: right;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    width: 100%;
}

.button-grid button {
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    color: var(--white);
    background: var(--gradient-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-grid button.clear {
    grid-column: span 4;
    background: var(--error);
}

.button-grid button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

/* Footer */
footer {
    background: var(--glass-dark);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .quick-nav {
        position: relative;
        top: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }
    .quick-nav a {
        font-size: 0.85rem;
    }
}