/* =========================================
   1. RESET & VARIABLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

:root {
    --primary: #C46A4B;           /* Terracotta */
    --primary-dark: #8A4A34;      /* Terre cuite foncée */
    --secondary: #F4EDE4;         /* Crème sable */
    --text: #5A3E36;              /* Brun chaud */
    --accent: #D9A273;            /* Nude / doré bohème */
    --glass: rgba(255, 248, 240, 0.92);
    --glass-transparent: rgba(255, 248, 240, 0.45);
	--icon-filter:
        invert(54%) sepia(32%) saturate(828%)
        hue-rotate(335deg) brightness(95%) contrast(88%);
	--icon-filtermenu:
        brightness(0) invert(1);
}

/* =========================================
   2. GLOBAL LAYOUT
   ========================================= */
body {
    min-height: 100vh;
    background-image: url("background_espace.png?v=5");
    background-repeat: no-repeat;
    background-position: 10% top;
    background-size: cover;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    color: var(--text);
    background-color: #F7EFE7; /* chaleur bohème */
}

/* Centrage par défaut pour certaines pages (login, musique, audio...) */
body.center-content {
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}
body.index-page {
    background-image: url("background_index.png?v=5");
}
h1,
h2,
h3 {
     font-family: 'Playfair Display', serif;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   3. NAVIGATION (HEADER & MOBILE)
   ========================================= */

/* Desktop Header */
.desktop-header-menu {
    display: flex;
    justify-content: space-around;
   background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 0.5rem 0;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.desktop-header-menu button {
    flex: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.desktop-header-menu img {
    width: 28px;
    height: 28px;
    filter: var(--icon-filtermenu);
}

.desktop-header-menu button:hover {
    transform: scale(1.1);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu button {
    flex: 1;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem 0;
}

.mobile-menu img {
    width: 28px;
    height: 28px;
    filter: var(--icon-filtermenu);
}

.mobile-menu button:hover img {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

@media (max-width: 768px) {
    .desktop-header-menu {
        display: none;
    }

    .mobile-menu {
        display: flex;
    }
}

/* =========================================
   4. CONTAINERS & CARDS
   ========================================= */
.container {
    background: var(--glass);
    padding: 2rem;
    border-radius: 22px;
    box-shadow: 0 15px 35px rgba(196, 106, 75, 0.25);
    border: 1px solid rgba(196, 106, 75, 0.2);
    width: 100%;
    max-width: 600px;
    /* Par défaut */
    margin: 0 auto;
}

.container-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    border-radius: 20px 20px 0 0;
    /* Si utilisé comme entête de container */
    margin: -2rem -2rem 1rem -2rem;
    /* Pour coller aux bords si padding container */
    width: calc(100% + 4rem);
}

/* Fix pour certains layouts où container-header est utilisé différemment */
.container.full-height {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Le header gère le padding */
    overflow: hidden;
    max-width: 1000px;
}

.container.full-height .container-header {
    margin: 0;
    width: 100%;
    border-radius: 0;
}

/* =========================================
   5. COMPONENTS (BUTTONS, INPUTS)
   ========================================= */
button,
.btn-submit,
.action-btn,
.download-all,
.copy-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
	box-shadow: 0 4px 12px rgba(196, 106, 75, 0.25);
	margin-top: 0.8rem;
}
.copy-btn img {
    width:28px;
	height:28px;
	vertical-align:middle;
	margin-right:6px;
	filter: var(--icon-filtermenu);
}

.action-btn img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 4px;
	filter: var(--icon-filtermenu);
}
button:hover,
.btn-submit:hover,
.action-btn:hover,
.download-all:hover,
.copy-btn:hover {
    transform: translateY(-2px);
     box-shadow: 0 8px 20px rgba(196, 106, 75, 0.35);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input,
select {
    width: 100%;
    padding: 0.9rem;
    border-radius: 14px;
    border: 2px solid #E8D9C9;
    background: #FFF9F4;
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    
}

input:focus,
select:focus {
    border-color: var(--primary);
}

/* =========================================
   6. PAGE: LOGIN (index.php)
   ========================================= */
.login-box {
    background: var(--glass);
    padding: 2.5rem;
    border-radius: 22px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(45, 99, 73, 0.2);
}

.login-box h1 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.login-box p {
    color: #666;
    margin-bottom: 2rem;
}

/* =========================================
   7. PAGE: ESPACE (espace.php)
   ========================================= */

.wrapper-espace {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 350px;
    width: 90%;
}

.container-espace {
    background: var(--glass);
    padding: 2rem;
    border-radius: 22px;
    width: calc(100% - 250px);
    margin-left: 250px;
    height: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid rgba(45, 99, 73, 0.2);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.header-espace {
    width: calc(100% - 250px);
    margin-left: 250px;
    border-radius: 14px;
}

@media (max-width:768px) {
    .wrapper-espace {
        margin-top: 0;
        width: 90%;
        align-items: center;
    }

    .container-espace {
        width: 100%;
        margin-left: 0;
        height: auto;
        border-radius: 22px;
        padding: 1.5rem;
        align-items: center;
    }

    .header-espace {
        display: none;
    }

}

@media (max-aspect-ratio: 3/4) {
    body {
        background-position: 10% top;
        background-size: 120%;
    }
}
    /* =========================================
   8. PAGE: GALLERIE
   ========================================= */
    .download-wrapper {
        display: flex;
        justify-content: center;
        padding: 1rem;
        background: var(--glass-transparent);
    }

    .folder-nav {
        padding: 1rem;
        background: rgba(255, 255, 255, 0.6);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .folder-nav h3 {
        color: var(--primary);
        margin-bottom: 0.8rem;
        font-size: 1.1rem;
    }

    .folder-list {
        display: flex;
        gap: 0.8rem;
        flex-wrap: wrap;
    }

    .folder-btn {
        padding: 0.6rem 1.2rem;
        background: #fff;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 600;
        color: #555;
        text-decoration: none;
        display: inline-block;
    }

    .folder-btn:hover,
    .folder-btn.active {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    .folder-count {
        font-size: 0.85rem;
        opacity: 0.8;
        margin-left: 0.3rem;
    }

    /* GALERIE */
    .gallery {
        padding: 0.8rem;
        display: grid;
        gap: 0.5rem;
    }

    @media(min-width:769px) {
        .gallery {
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        }
    }

    @media(max-width:768px) {
        .gallery {
            grid-template-columns: repeat(4, 1fr);
        }
    }

    .media-item img,
    .media-item video {
        width: 100%;
        height: 110px;
        object-fit: cover;
        border-radius: 10px;
        cursor: pointer;
    }


    /* Viewer */
    .viewer {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.95);
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        backdrop-filter: blur(5px);
    }

    .viewer img,
    .viewer video {
        max-width: 95%;
        max-height: 85vh;
        border-radius: 8px;
        box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    }

    .viewer-counter {
        position: absolute;
        top: 20px;
        color: #fff;
        font-size: 1rem;
        background: rgba(0, 0, 0, 0.5);
        padding: 5px 15px;
        border-radius: 20px;
    }

    .nav-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: #fff;
        font-size: 3rem;
        padding: 0.5rem 1rem;
        cursor: pointer;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .nav-arrow:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    .nav-arrow-left {
        left: 20px;
    }

    .nav-arrow-right {
        right: 20px;
    }

    @media(max-width:768px) {
        .nav-arrow {
            display: none;
        }
    }

    .empty-state {
        text-align: center;
        padding: 3rem 1rem;
        color: #999;
    }

    .empty-state-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
        opacity: 0.5;
    }

    /* =========================================
   9. PAGE: PLAYLIST & AUDIO
   ========================================= */

    .preview-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
        margin-bottom: 1rem;
        max-height: 200px;
        overflow-y: auto;
    }

    .preview-item {
        position: relative;
        width: 100%;
        padding-top: 100%;
        border-radius: 8px;
        overflow: hidden;
        background: #f0f0f0;
    }

    .preview-item img,
    .preview-item video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .preview-item .video-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.5rem;
        color: #fff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    .tabs-scroll {
        overflow-x: auto;
        background: #fff;
        border-bottom: 1px solid #ddd;
        padding: 0.5rem;
        display: flex;
        gap: 0.5rem;
    }


    .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0.5rem 1rem;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    color: #666;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

    .tab-btn.active {
        background: var(--primary);
        color: #fff;
    }

    .new-playlist-btn {
        background: #cad7a7;
        color: #333;
		
    }

    .actions-bar {
        padding: 1rem;
        display: flex;
        justify-content: center;
        gap: 1rem;
        background: #f9f9f9;
        flex-wrap: wrap;
    }

    .action-btn.secondary {
        background: #795548;
    }

    .action-btn.danger {
        background: #d32f2f;
    }

    .music-list,
    .audio-list {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .music-item,
    .audio-item {
        position: relative;
        background: #fff;
        padding: 1rem;
        border-radius: 12px;
         box-shadow: 0 10px 25px rgba(196, 106, 75, 0.15);
        display: flex;
        align-items: center;
        gap: 1rem;
        transition: transform 0.2s ease;
        border: 1px solid rgba(0, 0, 0, 0.03);
    }

    .music-item:hover,
    .audio-item:hover {
        transform: translateX(5px);
        border-color: var(--accent);
    }

    .music-info {
        flex: 1;
    }
.music-link {
color: var(--primary);	
	
}
    .music-title,
    .audio-name {
        font-weight: bold;
        color: var(--primary);
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }
.music-title img {
        width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 4px;
    position: relative;
	filter: var(--icon-filter);
    }
    .music-artist {
        color: #666;
        font-size: 0.95rem;
    }

    .music-meta {
        font-size: 0.85rem;
        color: #999;
    }

    .music-platform {
        display: inline-block;
        padding: 0.2rem 0.5rem;
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 600;
        margin-left: 0.5rem;
    }

    .platform-spotify {
        background: #1DB954;
        color: #fff;
    }

    .platform-deezer {
        background: #FF0092;
        color: #fff;
    }

    .platform-texte {
        background: #e0e0e0;
        color: #666;
    }

    .play-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .delete-btn {
        background: #ffebee;
        color: #d32f2f;
        padding: 0.5rem;
        border-radius: 8px;
    }

    .delete-btn:hover {
        background: #ffcdd2;
    }

    /* Modal */
    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 2000;
        backdrop-filter: blur(4px);
    }

    .modal {
        background: #fff;
        width: 90%;
        max-width: 500px;
        padding: 2rem;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-title {
        font-size: 1.4rem;
        font-weight: bold;
        color: var(--primary);
        margin-bottom: 1.5rem;
        text-align: center;
    }

    .close-modal {
        position: absolute;
        right: 20px;
        top: 20px;
        font-size: 1.5rem;
        color: #999;
        background: none;
        border: none;
        cursor: pointer;
    }

    /* Deezer Results */
    .deezer-results {
        list-style: none;
        margin-top: -0.5rem;
        margin-bottom: 1rem;
        max-height: 150px;
        overflow-y: auto;
    }

    .deezer-results li {
        padding: 0.8rem;
        border-bottom: 1px solid #f0f0f0;
        cursor: pointer;
    }

    .deezer-results li:hover {
        background: #f9f9f9;
        color: var(--primary);
    }
@media (max-width:768px) { 
  .desktop-header-menu { display:none; } 
  .mobile-menu { display:flex; } 
  .container { height: calc(100vh - 60px); padding-bottom: 60px; } 
  .music-item { flex-direction: column; align-items: flex-start; padding-right: 3rem; } 
  .music-actions { width: 100%; } 
  .play-btn { flex: 1; justify-content: center; } 
  .drag-handle { position: absolute; right: 10px; top: 10px; font-size: 2rem; padding: 10px; }
}
    /* =========================================
   10. PAGE: QR CODE
   ========================================= */
    .qr-section {
        text-align: center;
        max-width: 600px;
        width: 100%;
    }

	
.icon-title-h1{ width: 45px;
    height: 45px;
    vertical-align: middle;
    margin-right: 4px;
    position: relative; 
	filter: var(--icon-filter);
	}	
	
    .qr-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
        margin-top: 1.5rem;
    }

    .qr-card {
        background: #fff;
        padding: 1.5rem;
        border-radius: 16px;
         box-shadow: 0 10px 25px rgba(196, 106, 75, 0.15);
        transition: transform 0.3s ease;
        border: 1px solid rgba(0, 0, 0, 0.03);
    }
	.icon-title { width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 4px;
    position: relative; 
	filter: var(--icon-filter);
	}
.icon-svg {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 4px;
    position: relative;
    top: -2px; /* Centrage alignement texte */
    /* Filtre pour colorer le SVG noir en #2D6349 */
    filter: var(--icon-filter);
}
    .qr-card:hover {
        transform: translateY(-5px);
        border-color: var(--primary);
    }

    .qr-card h3 {
        color: var(--primary);
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .qr-placeholder {
        width: 100%;
        aspect-ratio: 1;
        background: #fff;
        border: 2px dashed #cad7a7;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 1rem;
    }

    .qr-code {
        width: 100%;
        height: 100%;
        padding: 0.5rem;
    }

    .qr-link {
        font-size: 0.85rem;
        color: #666;
        word-break: break-all;
        background: #fff;
        padding: 0.6rem;
        border-radius: 8px;
        margin-top: 0.5rem;
    }
	

    /* =========================================
   11. GESTION DES ICÔNES NAV (audio.php / musique.php)
   ========================================= */
    .nav-icons {
        display: flex;
        justify-content: center;
        gap: 1.5rem;
        margin-bottom: 1rem;
    }

    .nav-icons a {
        display: block;
        transition: transform 0.2s;
    }

    .nav-icons a:hover {
        transform: scale(1.1);
    }

    .nav-icons img {
        width: 36px;
        height: 36px;
        opacity: 0.7;
        filter: var(--icon-filter);;
    }

    .nav-icons a.active img,
    .nav-icons a:hover img {
        opacity: 1;
    }

    /* Status Messages */
    .status {
        margin-top: 1.5rem;
        padding: 1rem;
        border-radius: 12px;
        background: #f9f9f9;
        color: #666;
        font-size: 0.9rem;
        display: none;
    }

    /* =========================================
   12. PAGE: PHOTOS (UPLOAD)
   ========================================= */
    .upload-area {
         border: 2px dashed var(--accent);
    background: rgba(255, 248, 240, 0.6);
        border-radius: 16px;
        padding: 2rem;
        cursor: pointer;
        transition: all 0.3s ease;
        
        margin-bottom: 1.5rem;
        position: relative;
    }

    .upload-area:hover,
    .upload-area.dragover {
        border-color: var(--primary);
        background: rgba(196, 106, 75, 0.08);
    }

    .upload-icon {
        font-size: 3rem;
        color: var(--primary);
        margin-bottom: 1rem;
    }

    .file-input-wrapper {
        position: relative;
        width: 100%;
        margin-bottom: 1.2rem;
    }

    .file-input {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
    }

    input[type="file"] {
        display: none;
    }

    .file-label {
        display: block;
        width: 100%;
        padding: 0.9rem;
        border-radius: 14px;
        border: 2px dashed #cad7a7;
        font-size: 1rem;
        color: #666;
        cursor: pointer;
        transition: all 0.3s ease;
        background: #f9f9f9;
    }

    .file-label:hover {
        border-color: var(--primary);
        background: #fff;
        color: var(--primary);
    }

    .file-label.has-files {
        border-color: var(--primary);
        background: linear-gradient(135deg, rgba(45, 99, 73, 0.1), rgba(85, 107, 47, 0.1));
        color: var(--primary-dark);
        font-weight: 600;
    }

    .preview-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
        margin-bottom: 1rem;
        max-height: 200px;
        overflow-y: auto;
    }

    .preview-item {
        position: relative;
        width: 100%;
        padding-top: 100%;
        border-radius: 8px;
        overflow: hidden;
        background: #f0f0f0;
    }

    .preview-item img,
    .preview-item video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .preview-item .video-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.5rem;
        color: #fff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    #progress-bar {
        width: 100%;
        background-color: #f3f3f3;
        border-radius: 8px;
        margin-bottom: 1rem;
        height: 10px;
        display: none;
        overflow: hidden;
    }

    .progress-bar {
        width: 100%;
        height: 4px;
        background: #e0e0e0;
        border-radius: 2px;
        overflow: hidden;
        margin-bottom: 1rem;
        display: none;
    }

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

    #status {
        font-size: 0.9rem;
        font-weight: bold;
        margin-bottom: 1rem;
        margin-top: 1rem;
    }

    .status.success {
        background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
        color: #4CAF50;
        padding: 0.8rem;
        border-radius: 12px;
        display: block;
    }

    .status.error {
        background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(229, 57, 53, 0.1));
        color: #f44336;
        padding: 0.8rem;
        border-radius: 12px;
        display: block;
    }

    .hint {
        font-size: 0.85rem;
        color: #999;
        margin-top: -0.8rem;
        margin-bottom: 1rem;
        text-align: left;
    }
.hint img {
        width: 15px;
    height: 15px;
    vertical-align: middle;
    margin-right: 4px;
    position: relative; 
	
	filter: var(--icon-filter);
    }
    .status.recording {
        display: block;
        background: rgba(45, 99, 73, 0.1);
        color: var(--primary);
        font-weight: bold;
    }