/* global.css - Global UI Design Styles for Study Loopholes */

/* CSS Variables for consistent theming */
:root {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2c2c2c;
    --accent-color: #00aaff;
    --text-color: #e0e0e0;
    --header-height: 60px;
    --light-primary-bg: #f9f9f9;
    --light-secondary-bg: rgba(255, 255, 255, 0.85);
    --light-text-color: #222;
    --construction-accent: #00ffcc;
}

/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

/* Global Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Base Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--primary-bg);
    color: var(--text-color);
    transition: all 0.5s ease-in-out;
    overflow-x: hidden;
}

/* Light Mode Styles */
body.light-mode {
    background-color: var(--light-primary-bg);
    color: var(--light-text-color);
}

/* Landing Page Specific Styles */
body.landing-page {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Subject Page Specific Styles */
body.subject-page {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Construction Page Specific Styles */
body.construction-page {
    font-family: 'Poppins', sans-serif;
    background: url('https://source.unsplash.com/1600x900/?construction,work') no-repeat center center/cover;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

/* Header Styles */
.header {
    background-color: var(--secondary-bg);
    padding: 0 40px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #444;
}

.header.center {
    justify-content: center;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--accent-color);
}

/* Navigation Links */
.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 300;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* Container Styles */
.container {
    max-width: 100%;
    width: 100%;
    padding: 40px 0;
    transition: background 0.5s ease-in-out, color 0.5s ease-in-out;
}

/* Landing Page Container */
.container.landing {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    max-width: 400px;
    animation: fadeInScale 0.6s ease forwards;
}

body.light-mode .container.landing {
    background: var(--light-secondary-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Subject Page Container */
.container.subject {
    background: rgba(0, 0, 0, 0.75);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    margin-top: 40px;
}

body.light-mode .container.subject {
    background: var(--light-secondary-bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Construction Page Container */
.container.construction {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: 500px;
    animation: fadeIn 1.5s ease-in-out;
    transition: transform 0.3s ease;
}

.container.construction:hover {
    transform: translateY(-5px);
}

/* Typography */
h1 {
    margin-bottom: 30px;
    font-size: 2.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: color 0.5s ease-in-out;
    animation: slideDown 0.6s ease forwards;
}

.construction-page h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    animation: fadeInDown 1s ease-in-out;
    text-transform: none;
    letter-spacing: normal;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.construction-page p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.small-text {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Button Styles */
button {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.4s ease-in-out;
    position: relative;
    overflow: hidden;
}

/* Landing Page Buttons */
.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.button-container button {
    width: 220px;
    padding: 14px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    background: linear-gradient(90deg, #444, #222);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
}

.button-container button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(255,255,255,0));
    transition: left 0.5s ease;
    border-radius: 8px;
}

.button-container button:hover::after {
    left: 100%;
}

.button-container button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8);
}

body.light-mode .button-container button {
    background: linear-gradient(90deg, #ccc, #fff);
    color: black;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

body.light-mode .button-container button::after {
    background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0));
}

.button-container button:active {
    transform: scale(0.95);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Back Button */
.back-button {
    background: none;
    color: var(--accent-color);
    font-size: 18px;
    padding: 10px 15px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
    margin-right: 20px;
}

.back-button:hover {
    background-color: rgba(0, 170, 255, 0.1);
    color: var(--accent-color);
    text-decoration: none;
}

/* Construction Page Button */
.button.construction {
    padding: 12px 25px;
    background-color: var(--construction-accent);
    color: #000;
    font-weight: 600;
    border-radius: 25px;
}

.button.construction:hover {
    background-color: #00ddaa;
}

/* Toggle Switch for Dark/Light Mode */
.toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.toggle-button {
    width: 60px;
    height: 30px;
    border-radius: 15px;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.toggle-button::before {
    content: '🌙';
    position: absolute;
    left: 5px;
    top: 5px;
    font-size: 16px;
    transition: transform 0.5s ease-in-out;
}

body.light-mode .toggle-button {
    background-color: black;
    color: white;
    box-shadow: 0 2px 8px rgba(255,255,255,0.3);
}

body.light-mode .toggle-button::before {
    content: '☀️';
    transform: translateX(30px);
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    justify-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 30px;
}

/* Responsive Grid Layout */
@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        padding: 0 20px;
    }
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
}

/* Loader Animation for Construction Page */
.loader {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--construction-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

/* Page Transition Effects */
body.fade-in {
    opacity: 1;
    transition: opacity 0.5s ease-in;
}

body.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

/* Animations */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 20px 15px;
        width: 95%;
        margin-top: 20px;
    }

    .container.landing {
        padding: 30px 20px;
        width: 95%;
    }

    .construction-page .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: 1.5px;
    }

    .construction-page h1 {
        font-size: 2rem;
    }

    p {
        font-size: 1rem;
    }

    .construction-page p {
        font-size: 1rem;
    }

    .button-container button {
        width: 100%;
        font-size: 18px;
        padding: 12px;
    }

    .header {
        padding: 0 20px;
    }
}

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

    .header h1 {
        font-size: 20px;
    }
}
