/* GLOBAL RESET */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

/* AUTHENTICATION PAGES (Full Screen) */
.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Modern gradient */
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    /* Optimal reading width */
    text-align: center;
}

.auth-logo {
    max-width: 200px;
    margin-bottom: 20px;
}

.auth-card h2 {
    margin-bottom: 20px;
    color: #333;
}

.auth-card form {
    text-align: left;
}

.auth-card button {
    width: 100%;
    margin-top: 10px;
    background: #667eea;
    /* Matches gradient theme */
}

.auth-card button:hover {
    background: #5a6fd1;
}

.back-link {
    display: block;
    margin-top: 20px;
    font-size: 0.9em;
    color: #666;
}

/* HEADER SECTION */
.site-header {
    background: #111;
    text-align: center;
    padding: 20px 10px;
}

.site-logo {
    max-width: 100%;
    width: 600px;
    /* Increased from 320px for better visibility */
    height: auto;
    display: block;
    margin: 0 auto;
}

/* NAVIGATION */
nav {
    background: #343a40;
    padding: 10px;
    text-align: center;
}

nav a {
    color: #fff;
    margin: 0 15px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    padding: 10px;
    display: inline-block;
    /* Increases touch target */
    transition: color 0.3s;
}

nav a:hover {
    color: #ffc107;
    text-decoration: none;
}

/* MAIN CONTAINER */
.container {
    padding: 30px;
    width: 90%;
    max-width: 1000px;
    margin: 30px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    /* Context for absolute positioning */
}

/* TYPOGRAPHY */
h1,
h2,
h3 {
    color: #2c3e50;
    margin-top: 0;
}

p {
    margin-bottom: 1.25em;
    font-size: 1.05em;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* HOMEPAGE DOWNLOAD LINK (Desktop default) */
.home-download-link {
    position: absolute;
    top: 30px;
    right: 30px;
    color: #6610f2;
    font-weight: bold;
    font-size: 1.2em;
    text-decoration: none;
    background: #f3e5f5;
    /* Subtle background to pop */
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #e1bee7;
}

.home-download-link:hover {
    background: #6610f2;
    color: #fff;
    text-decoration: none;
}

/* BUTTONS & ACTIONS */
.actions {
    margin-top: 30px;
    text-align: center;
}

button,
.download-btn,
input[type="submit"] {
    background: #222;
    color: white;
    border: none;
    cursor: pointer;
    text-align: center;
    display: inline-block;
    padding: 12px 25px;
    text-decoration: none;
    font-size: 1em;
    border-radius: 5px;
    transition: background 0.3s, transform 0.1s;
    margin: 5px;
}

button:hover,
.download-btn:hover {
    background: #444;
    transform: translateY(-2px);
}

/* HOMEPAGE LAYOUT */
.home-grid {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    /* Align to top */
    margin-top: 20px;
}

.home-text {
    flex: 1;
    /* Takes remaining space */
}

.home-image {
    flex: 0 0 280px;
    /* Smaller fixed width (was 350px) */
    max-width: 100%;
    margin-top: 60px;
    /* Pushed down to reveal download link */
}

.home-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transform: rotate(2deg);
    /* Stylish tilt */
    transition: transform 0.3s;
}

.home-image img:hover {
    transform: rotate(0deg) scale(1.02);
}

/* FORMS */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px;
    margin: 10px 0 20px 0;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
    /* Prevents iOS zooom */
}

/* EDITIONS / ARTICLES */
.article {
    background: #fff;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: box-shadow 0.3s;
}

.article:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* FOOTER */
footer {
    background: #222;
    color: #adb5bd;
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    font-size: 0.9em;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media screen and (max-width: 768px) {

    /* Navigation Stacking */
    nav {
        display: flex;
        flex-direction: column;
    }

    nav a {
        margin: 5px 0;
        border-bottom: 1px solid #444;
        padding: 15px;
        width: 100%;
        /* Full tap area */
        display: block;
    }

    nav a:last-child {
        border-bottom: none;
    }

    /* Container Adjustments */
    .container {
        width: 95%;
        padding: 20px;
        margin: 15px auto;
    }

    /* Homepage Link - Move to top, non-absolute */
    .home-download-link {
        position: static;
        /* Remove absolute positioning */
        display: block;
        text-align: center;
        margin-bottom: 20px;
        width: 100%;
        background: #6610f2;
        /* Filled button style on mobile */
        color: white;
    }

    /* Form Elements & Buttons */
    button,
    .download-btn,
    input[type="submit"] {
        width: 100%;
        /* Full width buttons */
        display: block;
        margin: 10px 0;
        padding: 15px;
        /* Larger tap target */
    }

    /* Text Adjustments */
    h2 {
        font-size: 1.5em;
    }

    p {
        font-size: 1em;
        text-align: left;
    }

    /* Homepage Grid Mobile */
    .home-grid {
        flex-direction: column-reverse;
        /* Image on top */
        gap: 20px;
    }

    .home-image {
        width: 100%;
        /* Full width */
        flex: auto;
        max-width: 300px;
        /* Limit size on mobile */
        margin: 0 auto;
    }

    /* Auth Page Mobile Optimizations */
    .auth-page {
        min-height: auto;
        /* Allow natural height */
        padding: 10px;
        align-items: flex-start;
        /* Start from top */
        padding-top: 20px;
    }

    .auth-card {
        padding: 20px;
        /* Reduced padding */
        margin-top: 10px;
        box-shadow: none;
        /* Cleaner look on mobile */
        border: 1px solid #eee;
    }

    .auth-logo {
        max-width: 150px;
        /* Smaller logo */
        margin-bottom: 15px;
    }
}