
:root {
    --primary-blue: #2a6fb8;
    --light-blue: #4a8dcf;
    --bg-color: #f4f7fa;
    --text-color: #333;
    --light-text-color: #f0f0f0;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    --hamburger-icon-color: var(--light-text-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    background-color: var(--primary-blue);
    color: var(--light-text-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    display: flex; /* For aligning logo and hamburger */
    justify-content: space-between; /* For desktop: logo left, hamburger right (though hamburger hidden) */
    align-items: center;
}

.logo-icon {
    font-size: 2.5rem;
    display: block; /* Ensure it takes its own space */
}

.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    color: var(--hamburger-icon-color);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px; /* Easier to tap */
}

.sidebar-nav {
    list-style: none;
    flex-grow: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--light-text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.sidebar-nav li a:hover {
    background-color: var(--light-blue);
}

.sidebar-nav i {
    font-size: 1.2rem;
    width: 30px;
    margin-right: 15px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
}

.add-button {
    width: 100%;
    padding: 12px;
    background-color: var(--light-blue);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-button i {
    margin-right: 8px;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
}

.search-bar {
    position: relative;
    width: 50%;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
}

.create-button {
    padding: 10px 20px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.content-body {
    padding: 20px;
    overflow-y: auto;
}

.content-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #555;
}

/* --- Card Grid & Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

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

.card-image {
    width: 100%;
    height: 150px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
}

.card-content {
    padding: 15px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid var(--border-color);
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    animation: slideIn 0.3s;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#url-textarea {
    width: 100%;
    height: 150px;
    margin: 20px 0;
    padding: 10px;
    font-family: monospace;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
}

.primary-button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-blue);
    border: none;
    color: white;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        /* flex-direction: row; */ /* Will be column when menu is open */
        align-items: normal; /* Reset for column layout */
        padding: 0; /* Full width control */
        height: auto; /* Adjusts to content: header + nav */
        position: relative; /* For absolute positioning of nav if needed */
        z-index: 100; /* Ensure sidebar is above main content if it overlays */
    }

    .sidebar-header {
        padding: 10px 15px; /* Adjusted padding for mobile */
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: var(--primary-blue); /* Ensure header has bg */
        height: 60px; /* Fixed height for the header part */
    }

    .logo-icon {
        font-size: 2rem; /* Slightly smaller for mobile header */
    }

    .hamburger-menu {
        display: block; /* Show hamburger on mobile */
    }

    .sidebar-nav {
        display: none; /* Hidden by default */
        width: 100%;
        background-color: var(--primary-blue); /* Same as sidebar */
        /* position: absolute; */ /* Alternative: absolute positioning */
        /* top: 60px; */ /* Position below header */
        /* left: 0; */
        /* z-index: 99; */ /* Below header but above other content */
        padding-bottom: 10px; /* Space at the bottom of the nav */
    }

    .sidebar.sidebar-open .sidebar-nav {
        display: block; /* Show nav when sidebar is open */
    }

    /* Adjustments for when sidebar-nav is visible */
    .sidebar.sidebar-open {
        /* If not using absolute positioning for nav, sidebar itself becomes column */
        flex-direction: column;
    }

    .sidebar-nav li a {
        padding: 12px 20px; /* Slightly adjusted padding for mobile */
    }

    .sidebar-footer { display: none; } /* Keep footer hidden on mobile */
    
    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .search-bar { width: 100%; }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .modal-content { margin: 20% auto; }
}