/* assets/css/style.css */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --background: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --error: #EF4444;
    --sidebar-bg: #1F2937;
    --sidebar-text: #F9FAFB;
    
    --radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.fade-in { animation: fadeIn 0.5s ease forwards; }
.fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.slide-in { animation: slideIn 0.5s ease forwards; animation-delay: var(--delay, 0s); opacity: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-block { width: 100%; }

.btn-secondary { background: var(--border); color: var(--text-main); }
.btn-secondary:hover { background: #d1d5db; }

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; border: 1px solid var(--border); border-radius: var(--radius); outline: none; transition: var(--transition); font-family: inherit; }
.input-icon input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Alerts */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.alert-error { background-color: #FEF2F2; color: #991B1B; border: 1px solid #F87171; }

/* Login Page */
.body-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%); }
.login-wrapper { width: 100%; max-width: 400px; padding: 1rem; }
.login-card { background: var(--surface); padding: 2.5rem; border-radius: 12px; box-shadow: var(--shadow-lg); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h2 { color: var(--primary); font-size: 1.8rem; margin-bottom: 0.5rem; }
.login-header p { color: var(--text-muted); font-size: 0.95rem; }

/* App Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background-color: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; z-index: 100; }
.sidebar-header { padding: 1.5rem; font-size: 1.5rem; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header i { color: var(--primary); margin-right: 0.5rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-nav a { display: flex; align-items: center; padding: 0.8rem 1.5rem; color: rgba(255,255,255,0.7); text-decoration: none; transition: var(--transition); gap: 0.75rem; }
.sidebar-nav a:hover, .sidebar-nav a.active { background-color: rgba(255,255,255,0.05); color: #fff; border-left: 4px solid var(--primary); }
.sidebar-nav a i { width: 20px; text-align: center; }
.sidebar-footer { padding: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { margin-bottom: 1rem; }
.user-role { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.user-name { font-weight: 600; font-size: 1.1rem; }
.btn-logout { display: inline-flex; width: 100%; padding: 0.6rem; background: rgba(239, 68, 68, 0.1); color: #FCA5A5; text-decoration: none; justify-content: center; align-items: center; gap: 0.5rem; border-radius: var(--radius); transition: var(--transition); }
.btn-logout:hover { background: #EF4444; color: #fff; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
.topbar { background: var(--surface); padding: 1.5rem 2rem; box-shadow: var(--shadow-sm); z-index: 10; }
.topbar h1 { font-size: 1.5rem; font-weight: 600; }
.content-wrapper { padding: 2rem; flex: 1; overflow-y: auto; }

/* Dashboard Cards */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: 1.5rem; transition: var(--transition); text-decoration: none; color: inherit; }
.card-icon { width: 60px; height: 60px; border-radius: var(--radius); background: rgba(79, 70, 229, 0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); cursor: pointer; }
.action-card:hover .card-icon { background: var(--primary); color: white; }
.card-info h3 { margin-bottom: 0.25rem; }
.card-info p { color: var(--text-muted); font-size: 0.9rem; }

/* Badges */
.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-admin { background: #FEE2E2; color: #991B1B; }
.badge-producteur { background: #FEF3C7; color: #92400E; }
.badge-diffuseur { background: #D1FAE5; color: #065F46; }

/* Tables */
.table-container { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.5rem; text-align: left; }
th { background: #F9FAFB; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); font-size: 0.95rem; }
tbody tr:hover { background: #F9FAFB; }

/* Action Links */
.action-links a { color: var(--primary); margin-right: 0.75rem; text-decoration: none; }
.action-links a:hover { color: var(--primary-hover); text-decoration: underline; }
.action-links a.text-error { color: var(--error); }

/* Logo */
.logo-img {
    height: auto;
    width: 100%;
    max-height: 45px;
    object-fit: contain;
}
.sidebar-header .logo-img {
    max-height: 45px;
}
.login-header .logo-img {
    max-height: 60px;
    margin-bottom: 1rem;
    width: auto;
    max-width: 100%;
}

/* Media List */
.media-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.media-list-item {
    display: flex;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    gap: 1rem;
    border: 1px solid var(--border);
}
.media-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background: #000;
    flex-shrink: 0;
}
.media-thumbnail img, .media-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    pointer-events: none;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}
.media-filename {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: transparent;
}
.modal-content img, .modal-content video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: block;
}
.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
}
.modal-close:hover {
    color: var(--error);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .sidebar.menu-open {
        max-height: 100vh;
        overflow-y: auto;
    }
    .sidebar-header {
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .sidebar-header .logo-img {
        margin: 0;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .sidebar-nav {
        display: none; /* Hidden by default */
        flex-direction: column;
        padding: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .sidebar.menu-open .sidebar-nav {
        display: flex;
    }
    .sidebar-nav a {
        padding: 1rem;
        border-left: 4px solid transparent;
        border-bottom: none;
        white-space: normal;
    }
    .sidebar-nav a:hover, .sidebar-nav a.active {
        border-left: 4px solid var(--primary);
        border-bottom: none;
    }
    .sidebar-footer {
        display: none; /* Hidden by default */
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1rem;
    }
    .sidebar.menu-open .sidebar-footer {
        display: flex;
    }
    .user-info {
        margin-bottom: 0;
        text-align: center;
    }
    .btn-logout {
        width: 100%;
        padding: 0.8rem;
    }
    .topbar {
        padding: 1rem;
    }
    .content-wrapper {
        padding: 1rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: 1.5rem;
    }
    .table-container {
        overflow-x: auto;
    }
    .card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .pub-listing-card {
        align-items: flex-start !important;
        text-align: left !important;
    }
    
    .media-list-item.card {
        flex-direction: row;
        text-align: left;
        flex-wrap: wrap;
        align-items: center;
    }
    .media-list-item.card .media-info {
        align-items: flex-start;
    }
    .media-list-item.card .media-actions {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .platforms-diffusion {
        flex-wrap: nowrap !important;
    }
    .diffusion-card {
        min-width: 0 !important;
        flex-direction: row !important;
        justify-content: center !important;
        padding: 0.5rem !important;
        gap: 0.5rem !important;
    }
    .diffusion-card i {
        margin: 0 !important;
    }
    .diffusion-card .platform-name {
        display: none !important;
    }
    .diffusion-card form label, .diffusion-card span {
        justify-content: center !important;
        width: auto !important;
        flex: 0 !important;
    }
}

