/* --- Global Styles & Variables --- */
:root {
    --color-primary: #007bff; 
    --color-cta-blue: #0A66C2; 
    --color-secondary-dark: #333;
    --color-text: #555;
    --color-light-bg: #f7f9fc; 
    --font-family-base: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-base);
    color: var(--color-secondary-dark);
    line-height: 1.6;
    background-color: white;
    /* 🛑 Centering the page content within a main container */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Utility Classes (Buttons/Links) --- */
.btn, 
.btn:link, 
.btn:visited {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s, opacity 0.3s;
    text-decoration: none !important; 
    display: inline-block; 
    text-align: center;
    font-size: 0.95rem; 
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-secondary {
    background-color: transparent;
    color: #555; 
    border: none; 
}

/* Hero Section Buttons */
.btn-cta-primary {
    background-color: var(--color-primary);
    color: white;
    padding: 14px 30px; 
    font-size: 1.15rem; 
    border-radius: 8px;
    margin-bottom: 10px; 
}

.btn-cta-secondary {
    background-color: transparent;
    color: var(--color-cta-blue); 
    border: 2px solid var(--color-cta-blue); 
    padding: 14px 30px;
    font-size: 1.15rem;
    margin-left: 15px;
    border-radius: 8px;
}

/* Final CTA Button */
.btn-cta-final {
    background-color: white;
    color: var(--color-cta-blue);
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: block; 
    width: auto;
    max-width: 400px;
    margin: 30px auto 0 auto;
}

/* --- Auth/Form Styling (login/register pages) --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh; 
    padding: 20px;
    width: 100%; /* Use 100% width inside the centered body */
}
.error-banner {
    background-color: #fdd; 
    color: #cc0000; 
    border: 1px solid #ffaaaa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}
.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px; 
}
.modal-form label {
    margin-top: 10px;
    display: block; /* Ensures label is on its own line */
    font-weight: 600;
    margin-bottom: 5px;
}

/* FIX FOR INPUT FIELD SIZING */
.modal-form input[type="email"],
.modal-form input[type="password"],
.modal-form input[type="text"] { 
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #f9f9f9;
    width: 100%; 
}

/* Tabs Styling (for login/register form) */
.tab-links {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    padding: 5px;
    background-color: #eee;
    border-radius: 8px;
}

.tab-link {
    flex: 1;
    padding: 8px 15px;
    border: none;
    background-color: transparent;
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s;
    text-decoration: none !important; 
    text-align: center;
}

.tab-link.active {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--color-secondary-dark);
}


/* --- Header/Navbar --- */
.navbar {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 15px 5%;
    border-bottom: 1px solid #eee;
    background-color: white;
    /* 🛑 Centering the entire navbar content */
    width: 100%; /* Use 100% of the body width */
    max-width: 1200px;
    margin: 0 auto; 
}
.logo-text {
    font-size: 1.6rem; 
    font-weight: 800;
    color: var(--color-cta-blue); 
    line-height: 1; /* Helps with precise vertical alignment */
}


/* --- Hero Section --- */
.hero-section {
    display: flex;
    align-items: center; /* 🛑 Ensures content is centered vertically */
    min-height: 500px; /* Gives the section breathing room */
    max-width: 1200px;
    margin: 60px auto; 
    padding: 0 5%; 
    gap: 40px;
    width: 100%; /* Use 100% of the max width */
}

.hero-content {
    flex: 1.2; 
    padding-right: 20px;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 25px; 
}

.hero-content .highlight {
    color: var(--color-cta-blue); 
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--color-text);
    margin-bottom: 30px;
    max-width: 550px;
}

.hero-image {
    flex: 1;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    max-width: 500px; 
    height: auto;
    border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); 
}

/* --- Value Proposition Section --- */
.value-prop-section {
    padding: 80px 5%;
    text-align: center;
    background-color: white; 
    width: 100%; /* Use 100% of the body width */
}

.value-prop-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 40px auto; /* 🛑 Added margin to separate from the title */
    width: 100%; /* Use 100% of the max width */
}

.feature-card {
    background-color: var(--color-light-bg); 
    padding: 30px;
    border-radius: 12px;
    text-align: left;
    border: 1px solid #eee; 
    height: 100%; /* 🛑 Ensures all cards are the same height */
    display: flex;
    flex-direction: column;
}

/* --- Final CTA Section --- */
.final-cta-section {
    padding: 80px 5%;
    text-align: center;
    width: 100%;
}

.cta-box {
    background-image: linear-gradient(to right, #0A66C2, #1f4068); 
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px; 
    border-radius: 12px;
    color: white;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

/* --- Footer --- */
footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eee;
    color: #888;
    font-size: 0.9rem;
    background-color: #fcfcfc;
    width: 100%;
}


/* --- Media Queries (RESPONSIVENESS) --- */

/* 1. Tablet View (Screens up to 992px) */
@media (max-width: 992px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        margin-top: 40px;
        min-height: auto;
    }
    .hero-content {
        padding-right: 0;
    }
    .hero-content h1 {
        font-size: 3rem;
    }
    .hero-image {
        margin-top: 30px;
        order: 2; 
    }
    .hero-buttons {
        display: flex;
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* 2. Mobile View (Screens up to 576px) */
@media (max-width: 576px) {
    .navbar {
        flex-wrap: wrap;
        padding: 10px 4%;
        max-width: 100%;
    }
    .auth-actions {
        order: 3; 
        width: 100%;
        margin-top: 10px;
        display: flex;
        justify-content: space-between;
    }
    .auth-actions a {
        flex: 1;
        margin-left: 5px;
        margin-right: 5px;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }
    .hero-content p {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    .btn-cta-secondary {
        margin-left: 0;
        margin-top: 10px;
        width: 100%; 
    }
    .btn-cta-primary {
        width: 100%;
    }

    .features-grid {
        grid-template-columns: 1fr; 
    }

    .cta-box {
        padding: 40px 20px;
    }
    .btn-cta-final {
        font-size: 1.1rem;
    }
}

/* --- APP LAYOUT (Sidebar + Content) --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 250px;
    background-color: white;
    border-right: 1px solid #ddd;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 40px;
    padding-left: 10px;
}

.sidebar nav a {
    display: block;
    padding: 12px 15px;
    color: #555;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 600;
    transition: 0.2s;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background-color: #e6f0ff;
    color: var(--color-primary);
}

.sidebar nav a i {
    width: 25px; /* icon spacing */
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px;
}

.page-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

/* --- SETTINGS PAGE STYLES --- */
.settings-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 600px;
}

.profile-upload-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #eee;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
}

/* --- MESSAGES PAGE STYLES --- */
.chat-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Send box smaller, Inbox larger */
    gap: 30px;
}

.chat-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
}

.message-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
}

/* =========================================
   MOBILE & TABLET FIXES (THE MAGIC PATCH)
   Paste this at the very bottom of style.css
   ========================================= */

@media (max-width: 900px) {

    /* 1. Fix the Sidebar Layout (Dashboard) */
    .app-container {
        flex-direction: column; /* Stack Sidebar on top of Content */
    }

    .sidebar {
        width: 100%; /* Full width */
        height: auto; /* Not full height */
        padding: 15px;
        border-right: none;
        border-bottom: 1px solid #ddd;
        flex-direction: row; /* Horizontal menu */
        overflow-x: auto; /* Scrollable if too many items */
        white-space: nowrap;
    }

    .sidebar .brand {
        margin-bottom: 0;
        margin-right: 20px;
        font-size: 1.2rem;
    }

    .sidebar nav {
        display: flex;
        gap: 10px;
    }

    .sidebar nav a {
        padding: 8px 12px;
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    /* 2. Fix the Main Content Area */
    .main-content {
        padding: 20px; /* Reduce padding on mobile */
        width: 100%;
        box-sizing: border-box;
    }

    /* 3. Fix the Chat/Messages Page */
    .chat-grid {
        display: flex;
        flex-direction: column-reverse; /* Put inputs below, messages top */
        gap: 20px;
    }
    
    .chat-box {
        width: 100%;
        box-sizing: border-box;
    }

    /* 4. Fix Tool Containers (Writer, SIWES, etc.) */
    .tool-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px !important;
        box-sizing: border-box;
        margin: 0 !important;
    }

    /* 5. Fix Form Inputs on Mobile */
    input, select, textarea {
        max-width: 100%;
        font-size: 16px; /* Prevents iOS zooming */
    }

    /* 6. Fix Feature Grid (Dashboard Icons) */
    .features-grid {
        grid-template-columns: 1fr !important; /* Force 1 column */
        gap: 15px;
        padding: 0;
    }

    /* 7. Fix Settings Page */
    .settings-card {
        padding: 20px;
    }
    .profile-upload-section {
        flex-direction: column;
        text-align: center;
    }
}

/* Extra Small Screens (Old Phones) */
@media (max-width: 480px) {
    .sidebar nav a {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    h1, h2 {
        font-size: 1.5rem !important; /* Shrink big titles */
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
}