

/* --- Global Styles & Variables --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --font-family: 'Lato', sans-serif;
    --heading-font: 'Inter', sans-serif;
    --border-radius: 5px;
    --header-height: 70px; /* Define a consistent header height */
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #fdfdfd;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

main.container {
    flex: 1;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: var(--heading-font);
    font-weight: 700;
}

/* --- Header & Navigation --- */
.main-header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 0 20px;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0;
}

.logo {
    font-family: var(--heading-font);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    flex-shrink: 0; /* Prevents logo from shrinking */
}
.logo:hover { text-decoration: none; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 25px; /* Adds space between nav items */
    flex-grow: 1; /* Allows the nav to take up available space */
    justify-content: center; /* Centers the nav links within the available space */
}

.main-nav a {
    color: var(--dark-color);
    font-weight: 700;
    white-space: nowrap; /* Prevents nav links from breaking into two lines */
}
.main-nav a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.header-right { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.welcome-user { font-weight: bold; margin-right: 10px; }

/* --- Forms & Buttons --- */
.search-form { display: flex; align-items: center; }
.search-form input { 
    border: 1px solid #ccc; 
    padding: 0 10px; 
    border-radius: var(--border-radius) 0 0 var(--border-radius); 
    border-right: none; 
    height: 38px; /* Consistent height */
}
.search-form button { 
    background: var(--primary-color); 
    color: #fff; 
    border: none; 
    padding: 0 12px; 
    cursor: pointer; 
    border-radius: 0 var(--border-radius) var(--border-radius) 0; 
    height: 38px; /* Consistent height */
}

.button, .button-secondary {
    padding: 0 15px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: inline-flex; /* Use flex to center content */
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-align: center;
    height: 38px; /* Consistent height */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
.button {
    background-color: var(--primary-color);
    color: #fff;
}
.button:hover { background-color: #0056b3; border-color: #0056b3; text-decoration: none; color: #fff; }

.button-secondary { 
    background-color: #fff;
    color: var(--primary-color);
}
.button-secondary:hover { 
    background-color: #f8f9fa; 
    text-decoration: none;
}

/* Form Styling */
.form-container { max-width: 600px; margin: 40px auto; padding: 30px; background: #fff; box-shadow: 0 0 15px rgba(0,0,0,0.1); border-radius: var(--border-radius); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    box-sizing: border-box;
}
.form-group textarea { min-height: 150px; resize: vertical; }

/* --- Software & Script Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #eee;
}
.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-content h3 { margin-top: 0; }
.card-content p { flex-grow: 1; }
.card-footer { padding: 0 20px 20px; }


/* --- Single Item Page --- */
.item-header {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 30px;
}
.item-image {
    max-width: 300px;
    flex-shrink: 0;
    border-radius: var(--border-radius);
}
.item-details h1 { margin-top: 0; }
.item-details .meta { color: #666; margin-bottom: 20px; }

/* --- Scripts Library --- */
.code-box {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    margin: 20px 0;
}
pre { margin: 0; }

/* --- Tags Styling --- */
.tags-container {
    margin-bottom: 20px;
}
.tag-badge {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    font-weight: bold;
    margin-right: 5px;
    margin-bottom: 5px;
    text-decoration: none;
    transition: background-color 0.2s;
}
.tag-badge:hover {
    background-color: #ced4da;
    color: #212529;
    text-decoration: none;
}

/* --- Mobile Responsiveness --- */
.mobile-menu-toggle { display: none; }
.header-menu-wrapper { 
    display: flex; 
    align-items: center; 
    gap: 25px;
    flex-grow: 1; /* This makes the wrapper fill the available space */
}

@media (max-width: 992px) {
    .header-menu-wrapper {
        display: none; /* Hide the wrapper by default on mobile */
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: #fff;
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        border-top: 1px solid #eee;
        flex-grow: 0; /* Disable flex-grow on mobile */
    }
    .header-menu-wrapper.active {
        display: flex; /* Show the wrapper when active */
    }
    .main-nav {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0;
        flex-grow: 0; /* Disable flex-grow on mobile */
    }
    .main-nav a {
        padding: 15px;
        text-align: center;
        border-bottom: 1px solid #f0f0f0;
    }
    .header-right {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
    }
    .search-form input {
        width: 100%;
    }
    .mobile-menu-toggle { 
        display: block; 
        background: none; 
        border: none; 
        font-size: 1.8rem; 
        cursor: pointer;
    }
}

/* --- Footer --- */
.main-footer {
    background: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}
.main-footer a { color: #fff; }
