/* PartyWorks I2V Studio - Main Stylesheet */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light-gray);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

/* Navigation */
nav {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav .nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

nav .logo {
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    /* REVERTED: Removed margin-right: auto; */
}

nav .nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    /* FIX: This centers the links by consuming space equally on both sides */
    margin: 0 auto;
}

nav .nav-links a {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

nav .nav-links a:hover {
    color: var(--primary);
}

nav .user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- New Navigation Component Styles (Visibility on Desktop) --- */
.hamburger-btn {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--dark);
    margin: 5px 0;
    transition: transform 0.3s, opacity 0.3s;
}

/* Global visibility control to prevent desktop duplication */
.nav-wrapper {
    display: none; /* Hides the mobile menu container on desktop */
}
.user-menu-mobile {
    display: none; /* Hides the mobile version of the user menu on desktop */
}
.user-menu-desktop {
    display: flex; /* Ensures the desktop user menu is visible */
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem .75rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--light-gray);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 1.75rem;
    height: 1.75rem;
    cursor: pointer;
}

/* File Upload Area */
.upload-area {
    border: 2px dashed var(--gray);
    border-radius: var(--radius);
    padding: 2rem 2rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area svg {
    width: 3rem;
    height: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--gray);
    margin-bottom: 0.5rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--light-gray);
    border-radius: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 1rem;
}

.badge-success {
    background: #d1fae5;
    color: var(--success);
}

.badge-warning {
    background: #fef3c7;
    color: var(--warning);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger);
}

.badge-info {
    background: #dbeafe;
    color: var(--primary);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.gallery-item {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item-info {
    padding: 0rem 1rem 1rem 1rem;
    margin-top: 0rem;
}

.gallery-item-title {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.gallery-item-meta {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.gallery-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gallery-item-actions button {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.5rem;
}

/* --- Styles moved from gallery.php <style> block --- */

/* Minimal styles for the actions dropdown */
.gallery-item-action-wrapper {
    position: relative;
    display: inline-block; /* Crucial for positioning dropdown */
    margin-left: 0.5rem;
}

.gallery-item-action-dropdown {
    position: absolute;
    bottom: 100%; /* Position above the wrapper */
    right: 0;
    z-index: 10;
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 0.3rem;
    min-width: 150px;
    margin-bottom: 5px; /* Spacing from button */
}

.gallery-item-action-dropdown .btn,
.gallery-item-action-dropdown a {
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.8rem !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* Styling for the small actions button */
.btn-action-trigger {
    padding: 0.25rem 0.5rem; 
    font-size: 0.75rem; 
    width: 24px; 
    height: 24px; 
    border-radius: 50%; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    line-height: 1;
    font-weight: bold;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: var(--primary);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    /* --- NEW/MODIFIED NAVIGATION STYLES FOR MOBILE --- */
    
    /* 1. Hide Desktop Links and Menu */
    nav .nav-links {
        display: none; /* Hide the primary desktop links */
        margin: 0; /* Reset margin on hidden element */
    }
    
    .hamburger-btn {
        display: block; /* Show hamburger icon */
    }
    
    .user-menu-desktop {
        display: none; /* Hide full desktop user menu */
    }

    /* 2. Show and Style the Mobile Wrapper (The Slide-out Container) */
    .nav-wrapper {
        display: flex; /* Override global display: none to show it */
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: var(--white);
        padding: 60px 2rem 2rem; 
        transform: translateX(100%); 
        transition: transform 0.3s ease-in-out;
        box-shadow: var(--shadow-lg);
        z-index: 999;
        flex-direction: column;
        overflow-y: auto;
    }

    .nav-wrapper.active {
        transform: translateX(0); /* Slide into view */
    }

    /* 3. FIX: Style the mobile links list inside the wrapper 
       (Increased specificity to override desktop hiding rule) */
    .nav-wrapper .nav-links-mobile { 
        list-style: none;
        flex-direction: column; 
        gap: 1.5rem;
        padding-bottom: 1.5rem;
        display: flex; /* THIS RULE NOW OVERRIDES display: none */
    }
    
    .nav-wrapper .nav-links-mobile a {
        font-size: 1.1rem;
        display: block;
    }

    /* 4. Mobile User Menu: Show simplified version inside the wrapper */
    .user-menu-mobile {
        display: flex;
        flex-direction: column; 
        align-items: flex-start; 
        padding: 1rem 0;
        border-top: 1px solid var(--light-gray);
    }
    
    .user-menu-mobile span {
        margin-right: 0 !important; 
        margin-bottom: 0.5rem;
    }
    
    .user-menu-mobile .btn-outline {
        width: 100%;
        text-align: center;
    }
    
    /* --- END NAVIGATION STYLES --- */
    
    /* Existing general mobile styles */
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 1rem;
    }

    /* Utility Class Fix for small screens */
    .ratio-control-group {
        flex-wrap: wrap; 
        justify-content: center;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.ratio-control-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.ratio-selector {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 6px;
    transition: all 0.2s;
}
.ratio-selector:hover {
    border-color: #999;
}
.ratio-selector.active {
    border-color: var(--primary, #007bff); /* Uses your primary color */
    background-color: #f0f8ff; /* Light background for selected */
}
.ratio-icon {
    margin: 5px auto;
    background-color: #444;
    border: 1px solid #222;
}
/* Visual box dimensions */
.ratio-16-9 {
    width: 64px; /* 16 * 4 */
    height: 36px; /* 9 * 4 */
}
.ratio-9-16 {
    width: 36px; /* 9 * 4 */
    height: 64px; /* 16 * 4 */
}
.ratio-label {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}
/* Hide the default radio button */
.ratio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}