/* --- 1. Global Setup & Google Font --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    /* General Properties */
    --border-radius-large: 1.75rem; /* 28px */
    --border-radius-medium: 1rem; /* 16px */
    --border-radius-small: 0.75rem; /* 12px */
    --nav-width: 72px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-nav-pill: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}

/* --- 2. Color & Theme Variables (7 Palettes) --- */
[data-theme="light"][data-color="green"] {
    --bg-color: #f7fbf6; --surface-color: #e3ede1; --primary-color: #34693a; --secondary-color: #536350;
    --text-color: #191d19; --text-color-muted: #414940; --nav-hover-bg: #dde8da;
    --glass-bg: rgba(230, 240, 228, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="blue"] {
    --bg-color: #f5fafe; --surface-color: #e1eaf5; --primary-color: #00639a; --secondary-color: #50606f;
    --text-color: #191c1e; --text-color-muted: #41474d; --nav-hover-bg: #dae3f0;
    --glass-bg: rgba(225, 234, 245, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="indigo"] {
    --bg-color: #f8f8ff; --surface-color: #e3e0f9; --primary-color: #4344a8; --secondary-color: #5a5a72;
    --text-color: #1a1a21; --text-color-muted: #454559; --nav-hover-bg: #dbd9ee;
    --glass-bg: rgba(227, 224, 249, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="purple"] {
    --bg-color: #fbf7ff; --surface-color: #e9e0f5; --primary-color: #5f52a7; --secondary-color: #5d5c71;
    --text-color: #1b1b21; --text-color-muted: #464653; --nav-hover-bg: #e0d9ed;
    --glass-bg: rgba(233, 224, 245, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="red"] {
    --bg-color: #fff8f7; --surface-color: #f5e3e1; --primary-color: #b3261e; --secondary-color: #795552;
    --text-color: #201a1a; --text-color-muted: #534342; --nav-hover-bg: #f0dcd9;
    --glass-bg: rgba(245, 227, 225, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="orange"] {
    --bg-color: #fff8f5; --surface-color: #f5e5de; --primary-color: #8c5000; --secondary-color: #715a45;
    --text-color: #211a13; --text-color-muted: #53443a; --nav-hover-bg: #f0e0d8;
    --glass-bg: rgba(245, 229, 222, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="light"][data-color="teal"] {
    --bg-color: #f2fbf8; --surface-color: #d8ede4; --primary-color: #006b55; --secondary-color: #4b635a;
    --text-color: #161d1a; --text-color-muted: #3d4944; --nav-hover-bg: #cce3d9;
    --glass-bg: rgba(216, 237, 228, 0.5); --glass-border: rgba(255, 255, 255, 0.3);
}
[data-theme="dark"][data-color="green"] {
    --bg-color: #111311; --surface-color: #242623; --primary-color: #9cd69c; --secondary-color: #bdcbb4;
    --text-color: #e2e3e1; --text-color-muted: #a3a9a2; --nav-hover-bg: #30332f;
    --glass-bg: rgba(30, 32, 29, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="blue"] {
    --bg-color: #101416; --surface-color: #242a2e; --primary-color: #9bcffa; --secondary-color: #b8c8d9;
    --text-color: #e1e2e4; --text-color-muted: #a1a7ad; --nav-hover-bg: #30363b;
    --glass-bg: rgba(36, 42, 46, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="indigo"] {
    --bg-color: #121219; --surface-color: #252530; --primary-color: #bec0ff; --secondary-color: #c2c2da;
    --text-color: #e3e1e8; --text-color-muted: #a6a6b8; --nav-hover-bg: #31313c;
    --glass-bg: rgba(37, 37, 48, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="purple"] {
    --bg-color: #131318; --surface-color: #282830; --primary-color: #cfbfff; --secondary-color: #c5c4d9;
    --text-color: #e4e1e8; --text-color-muted: #a8a7b3; --nav-hover-bg: #34343d;
    --glass-bg: rgba(40, 40, 48, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="red"] {
    --bg-color: #181211; --surface-color: #2c2524; --primary-color: #ffb4a9; --secondary-color: #e7bdb9;
    --text-color: #ece0de; --text-color-muted: #b4a8a7; --nav-hover-bg: #393130;
    --glass-bg: rgba(44, 37, 36, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="orange"] {
    --bg-color: #18120c; --surface-color: #2c251e; --primary-color: #ffb86f; --secondary-color: #e1c0a0;
    --text-color: #ece0d6; --text-color-muted: #b4a89d; --nav-hover-bg: #393129;
    --glass-bg: rgba(44, 37, 30, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"][data-color="teal"] {
    --bg-color: #0f1412; --surface-color: #212624; --primary-color: #7ee8cc; --secondary-color: #b1ccc2;
    --text-color: #e0e3e1; --text-color-muted: #a0a9a5; --nav-hover-bg: #2d3330;
    --glass-bg: rgba(33, 38, 36, 0.5); --glass-border: rgba(255, 255, 255, 0.1);
}

/* --- 3. Body & Smooth View Transition --- */
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* NEW: Symmetrical fade for theme/color change */
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes fade-out {
  to { opacity: 0; }
}
::view-transition-old(root) {
  animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both fade-out;
}
::view-transition-new(root) {
  animation: 400ms cubic-bezier(0.4, 0, 0.2, 1) 50ms both fade-in;
}

/* --- 4. NEW Top-Right Options Menu --- */
.top-left-options {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 200;
}

.options-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.options-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.options-btn .material-icons-outlined {
    font-size: 22px;
}

.options-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: auto;
    background-color: var(--surface-color);
    border-radius: var(--border-radius-medium);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    box-sizing: border-box;
    display: flex;
    gap: 0.5rem;
    
    /* Smooth Dropdown Animation */
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.options-dropdown.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--nav-hover-bg);
    transform: scale(1.05);
}

.dropdown-item .material-icons-outlined {
    font-size: 20px;
}

/* --- 5. Side Navigation --- */
.side-nav {
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-large);
    padding: 0.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: var(--transition-smooth);
    z-index: 100;
}

.side-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* The moving active pill */
.nav-active-pill {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    border-radius: var(--border-radius-medium);
    z-index: 1;
    transition: var(--transition-nav-pill);
    list-style: none;
}

.nav-link {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-medium);
    text-decoration: none;
    color: var(--text-color-muted);
    transition: color 0.2s ease, background-color 0.2s ease;
    z-index: 2;
    position: relative;
}

.nav-link .material-icons-outlined {
    font-size: 22px;
}

.nav-link:hover {
    color: var(--text-color);
    background-color: var(--nav-hover-bg);
}

/* Tooltip for desktop */
.nav-link::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 120%;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    background-color: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-small);
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    transition-property: transform, opacity;
}

.nav-link:hover::before {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.nav-link.active {
    color: var(--bg-color);
}
.nav-link.active:hover {
    background-color: transparent;
    color: var(--bg-color);
}

/* --- 6. Main Content --- */
.main-content {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
    padding-left: var(--nav-width);
    box-sizing: border-box;
    perspective: 1000px;
}

.motion-text {
    font-size: 6rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    transition: all 0.1s linear; 
    text-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.logo-highlight {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

/* --- 7. Glassmorphism Footer --- */
.glass-footer {
    position: fixed;
    bottom: 1.5rem;
    left: calc((var(--nav-width) / 2) + 50%);
    transform: translateX(-50%);
    width: 100%;
    max-width: 450px;
    padding: 1.25rem 2rem;
    box-sizing: border-box;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-medium);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    color: var(--text-color-muted);
    font-weight: 500;
    transition: var(--transition-smooth);
    z-index: 100;
}

.glass-footer:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.15);
}

.glass-footer p {
    margin: 0;
}

/* --- 8. Footer Icon Animation --- */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.35); }
}
.footer-icon { display: inline-block; }
.glass-footer.is-hovered .icon-1 { animation: pulse 0.6s ease-in-out 1; }
.glass-footer.is-hovered .icon-2 { animation: pulse 0.6s ease-in-out 1 0.3s; }

/* --- 9. Mobile Responsiveness --- */
@media (max-width: 768px) {
    body {
        padding-bottom: 120px;
    }
    
    .main-content {
        padding-left: 2rem;
    }

    /* Move Nav to Bottom-Center */
    .side-nav {
        top: auto;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        padding: 0.5rem;
    }

    .side-nav ul {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    /* Disable desktop tooltip */
    .nav-link::before { display: none; }

    /* Keep Options Menu in Top-Right */
    .top-left-options {
        top: 1rem;
        right: 1rem;
    }

    /* Scale down logo */
    .motion-text {
        font-size: 3.5rem;
    }

    /* Un-fix the footer */
    .glass-footer {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 0 auto;
        max-width: 90%;
    }
    
    .glass-footer:hover {
        transform: scale(1.05);
    }
}

/* --- Tools Page Styles --- */
.tools-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.page-description {
    font-size: 1.25rem;
    color: var(--text-color-muted);
    text-align: center;
    margin: 0 auto 3rem auto;
    max-width: 600px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-medium);
    padding: 2rem;
    text-align: center;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 48px rgba(0,0,0,0.12);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

.tool-icon .material-icons-outlined {
    font-size: 2.5rem;
    color: #fff;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1);
    background: var(--secondary-color);
}

.tool-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.tool-description {
    color: var(--text-color-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-small);
    font-weight: 500;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.tool-link:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.tool-link .material-icons-outlined {
    font-size: 1.25rem;
}

/* --- Dynamic accent colors for each tool --- */
.tool-card[data-color] .tool-icon {
    background: var(--primary-color);
}

.tool-card[data-color="blue"] .tool-icon {
    background: #2196f3;
}

.tool-card[data-color="green"] .tool-icon {
    background: #4caf50;
}

.tool-card[data-color="red"] .tool-icon {
    background: #f44336;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tools-container {
        padding: 1rem;
    }

    .page-title {
        font-size: 2.5rem;
    }

    .page-description {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-icon {
        width: 70px;
        height: 70px;
    }

    .tool-icon .material-icons-outlined {
        font-size: 2rem;
    }
}

