/*
 * This CSS file is licensed under the MIT License.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 * Author: SDEV.CH
 * License: MIT License
 * Date: Feb 2024
 *
 * // May your code compile on the first try, and your bugs be ever in your favor.
 */

/* ==================== */
/* Global Variables     */
/* ==================== */

:root {
    /* Colors */
    --primary-color: #4285f4; /* Primary blue color */
    --secondary-color: #5f6368; /* Secondary gray color */
    --background-color: #f7f7f7; /* Light background color */
    --text-color: #202124; /* Dark text color */
    --box-shadow: 0 15px 50px rgba(0, 0, 0, 0.05); /* Subtle shadow */
    --console-bg: #1e1e1e; /* Dark console background */
    --console-text: #d4d4d4; /* Light console text */
    --console-accent: #4285f4; /* Accent color for console */
    --console-error: #f48771; /* Error color for console */
    --console-link: #4285f4; /* Link color for console */

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Typography */
    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.25rem;
    --font-family: 'Nunito Sans', sans-serif;
    --font-family-monospace: 'Consolas', 'Courier New', monospace;
}

/* ==================== */
/* Global Reset         */
/* ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Consistent box sizing */
}

/* ==================== */
/* Base Styles          */
/* ==================== */

body {
    font-family: var(--font-family);
    background: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    overflow: hidden;
    font-size: var(--font-size-base);
    line-height: 1.6; /* Improved readability */
}

/* ==================== */
/* Container Styles     */
/* ==================== */

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    padding: var(--spacing-xl);
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    max-width: 600px;
    width: 90%;
}

.container:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.container .logo {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 2.5rem;
    font-weight: bold;
    font-style: italic;
    border-radius: 5px;
    margin-bottom: var(--spacing-md);
}

.container .slogan {
    letter-spacing: 0.5px;
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-lg);
    color: var(--secondary-color);
}

.container .footer {
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    font-style: italic;
    text-align: center;
    margin-top: var(--spacing-md);
    opacity: 0.6;
    width: 100%;
    letter-spacing: 1px;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.container .footer:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* ==================== */
/* Responsive Styles    */
/* ==================== */

@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }

    .slogan {
        display: block;
        text-align: center;
        font-size: clamp(1rem, 5vw, 1.75rem);
        line-height: 1.4;
        color: var(--secondary-color);
        width: 100%;
        margin: 0 auto;
        visibility: hidden;
    }

    .slogan::before {
        content: "Solving problems,\A building the future.";
        white-space: pre-line;
        visibility: visible;
        color: var(--secondary-color);
        text-align: center;
        display: block;
    }

    .container {
        padding: var(--spacing-lg);
    }

    footer {
        font-size: var(--font-size-sm);
    }
}

/* ==================== */
/* Console Styles       */
/* ==================== */

.console-icon {
    position: fixed;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 5px;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    z-index: 1000;
    font-size: var(--font-size-sm);
    font-weight: bold;
    transition: opacity 0.3s ease, transform 0.3s ease;
    will-change: transform; /* Optimize animations */
}

.console-icon:hover {
    background: #252526;
    transform: scale(1.05);
}

.console-icon:active {
    transform: scale(0.95);
}

.console-container {
    position: fixed;
    bottom: -500px;
    right: var(--spacing-md);
    width: 600px;
    height: 400px;
    background: var(--console-bg);
    border-radius: 10px 10px 0 0;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: bottom 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
    z-index: 1000;
}

.console-container.open {
    bottom: 0;
}

.console-container.fullscreen {
    width: 100% !important;
    height: 100vh !important;
    bottom: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
}

.console-title-bar {
    background: #252526;
    padding: var(--spacing-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    cursor: default;
}

.console-title {
    color: var(--console-text);
    font-size: var(--font-size-sm);
    font-weight: bold;
}

.console-controls {
    display: flex;
    gap: var(--spacing-xs);
}

.console-controls div {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--console-text);
    transition: background 0.2s ease, transform 0.2s ease;
}

.console-controls div:hover {
    background: #444;
    transform: scale(1.1);
}

.console-controls div:active {
    transform: scale(0.9);
}

.console-controls .minimize-btn {
    color: #f1c40f;
}

.console-controls .maximize-btn {
    color: #2ecc71;
}

.console-controls .close-btn {
    color: #e74c3c;
}

.console-output {
    flex-grow: 1;
    padding: var(--spacing-xs);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--console-accent) #252526;
    font-family: var(--font-family-monospace);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--console-text);
    background: var(--console-bg);
}

.console-output::-webkit-scrollbar {
    width: 6px;
}

.console-output::-webkit-scrollbar-track {
    background: #252526;
}

.console-output::-webkit-scrollbar-thumb {
    background-color: var(--console-accent);
    border-radius: 3px;
}

/* ==================== */
/* Code Block Styles    */
/* ==================== */

.code-block {
    margin: var(--spacing-xs) 0;
    padding: var(--spacing-xs);
    background: #2d2d2d;
    border-radius: 5px;
    border-left: 4px solid var(--console-accent);
    animation: fadeIn 0.5s ease-in-out forwards;
    will-change: transform, opacity; /* Optimize animations */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== */
/* Code Line Styles     */
/* ==================== */

.code-line {
    display: flex;
    align-items: center;
    margin: 5px 0;
    opacity: 0;
    animation: fadeInLine 0.3s ease-in-out forwards;
    will-change: transform, opacity; /* Optimize animations */
}

@keyframes fadeInLine {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.line-number {
    min-width: 40px;
    color: #6c6c6c;
    font-size: var(--font-size-sm);
    text-align: right;
    margin-right: var(--spacing-xs);
    user-select: none;
}

.code-text {
    flex-grow: 1;
    color: var(--console-text);
}

.keyword {
    color: var(--primary-color);
}

.string {
    color: #ce9178;
}

.comment {
    color: #6a9955;
}

.number {
    color: #b5cea8;
}

.function {
    color: #dcdcaa;
}

.operator {
    color: #d4d4d4;
}

.error {
    color: var(--console-error);
}

.link {
    color: var(--console-link);
    text-decoration: underline;
    cursor: pointer;
}

.link:hover {
    opacity: 0.8;
}

/* ==================== */
/* Console Input Styles */
/* ==================== */

.console-input-container {
    display: flex;
    background: #252526;
    padding: var(--spacing-xs);
    border-top: 1px solid #333;
}

.console-input {
    background: transparent;
    border: none;
    color: var(--console-text);
    font-family: var(--font-family-monospace);
    font-size: var(--font-size-base);
    width: 100%;
    outline: none;
    caret-color: var(--console-accent);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
    border: 1px solid #333;
    transition: border-color 0.3s ease, font-size 0.3s ease;
}

.console-input::placeholder {
    color: #6c6c6c;
    font-style: italic;
}

.console-input:focus {
    border-color: var(--console-accent);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

/* ==================== */
/* Mobile Responsive Styles */
/* ==================== */

@media (max-width: 768px) {
    .console-input-container {
        padding: var(--spacing-xs);
        background: #1e1e1e;
    }

    .console-input {
        font-size: clamp(0.75rem, 4vw, 0.875rem);
        padding: var(--spacing-xs) var(--spacing-sm);
        border-radius: 3px;
    }

    .console-input::placeholder {
        font-size: var(--font-size-sm);
    }

    .console-container {
        width: 100%;
        right: 0;
        border-radius: 0;
    }

    .console-container.open {
        bottom: 0;
    }

    .console-container.fullscreen {
        height: 100vh !important;
    }

    .code-block {
        padding: var(--spacing-xs);
    }

    .code-line {
        font-size: clamp(0.625rem, 3.5vw, 0.75rem);
        line-height: 1.4;
    }

    .line-number {
        min-width: 25px;
        font-size: 0.5625rem;
    }
}

/* ==================== */
/* Background Animation */
/* ==================== */

.dynamic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    background: #f0f0f0;
}

.icon {
    position: absolute;
    animation: float ease-in-out infinite;
    opacity: 0.8;
    transform: translateY(0);
    will-change: transform, opacity; /* Optimize animations */
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
}