/* static/css/style.css */

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

body {
    font-family: 'Arial', sans-serif; 
    background-color: #f0f2f5; /* Default background for pages like login/register */
    margin: 0;
    padding: 0;
    color: #333;
}

/* --- Login & Register Page Specific Styles --- */
.login-page-body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f2f5; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px; 
    box-sizing: border-box;
}

.login-container { 
    background: #fff;
    padding: 35px 45px; 
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); 
    width: 100%;
    max-width: 400px; 
    text-align: center;
    margin: 0; 
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo img {
    max-width: 150px; 
    height: auto;
}

.login-container h2 { 
    font-size: 22px; 
    color: #333;
    margin-bottom: 30px;
    font-weight: 600; 
}

.login-form .form-field-group { 
    position: relative; 
    margin-bottom: 20px;
}

.login-form .field-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd; 
    z-index: 2; 
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] { 
    width: 100%;
    padding: 12px 15px 12px 40px; 
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    border-color: #007bff; 
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); 
}

.login-form p { 
    margin-bottom: 15px; 
    text-align: left; 
}
.login-form p label { 
    display: block;
    margin-bottom: 5px;
    font-weight: 500; 
}
.login-form p input { /* General input styling if form.as_p is used for some fields */
    width: 100%;
    padding: 10px; 
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
}

.form-options { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 13px;
}
.form-options .remember-me { display: flex; align-items: center; }
.form-options .remember-me input[type="checkbox"] { margin-right: 6px; vertical-align: middle; }
.form-options .remember-me label { margin-bottom: 0; color: #555; font-weight: normal; vertical-align: middle; }
.form-options .forgot-password { color: #007bff; text-decoration: none; }
.form-options .forgot-password:hover { text-decoration: underline; }

.btn-login { 
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase; 
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    width: 100%;
    margin-top: 5px; 
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}
.btn-login:hover { background-color: #0056b3; }

.signup-link { 
    margin-top: 25px; 
    font-size: 14px;
    color: #555;
}
.signup-link a { color: #007bff; text-decoration: none; font-weight: 500; }
.signup-link a:hover { text-decoration: underline; }

.login-form .error-message, 
.login-form ul.errorlist li { 
    color: #dc3545; 
    font-size: 0.875em;
    margin-top: -12px; 
    margin-bottom: 10px;
    text-align: left; 
    list-style-type: none; 
    padding-left: 0; 
}
.login-form ul.errorlist { 
    margin-top: -12px;
    margin-bottom: 10px;
    padding-left: 0;
}
.login-container .error-summary { 
    color: #721c24; 
    background-color: #f8d7da; 
    border: 1px solid #f5c6cb; 
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center; 
    font-size: 0.9em;
}

/* --- Dashboard Page Styles --- */
body.dashboard-page { 
    font-family: 'Roboto', sans-serif; 
    background-color: #f5f7fa; 
    color: #333;
}

body > .container.dashboard-layout { 
    max-width: none; margin: 0; padding: 0; box-shadow: none; border-radius: 0;
    display: flex; flex-direction: column; min-height: 100vh;
}

header {
    background-color: #fff; padding: 10px 20px; border-bottom: 1px solid #ddd; text-align: center;
}
header .logo { display: inline-block; }
header .logo img { max-height: 50px; width: auto; }

.content-wrapper { display: flex; flex: 1; }
.sidebar {
    width: 200px; background-color: #007bff; color: #fff; padding: 20px;
    display: flex; flex-direction: column; justify-content: flex-start; 
    flex-shrink: 0;
}
.sidebar .username { font-size: 1.2em; font-weight: bold; margin-bottom: 15px; }
.sidebar a.sidebar-link {
    display: flex; align-items: center; padding: 10px 0; 
    color: #fff; text-decoration: none; font-size: 0.95em;
    transition: background-color 0.2s ease-in-out, padding-left 0.2s ease-in-out;
    border-radius: 4px; margin-bottom: 5px; 
}
.sidebar a.sidebar-link:hover { background-color: rgba(255, 255, 255, 0.15); padding-left: 10px; text-decoration: none; }
.sidebar a.sidebar-link i.fas { margin-right: 12px; width: 20px; text-align: center; }
.sidebar a.sidebar-link.active { font-weight: bold; background-color: rgba(0, 0, 0, 0.1); }
.sidebar a.sidebar-link[style*="margin-top: auto"] { margin-top: auto; }

main { flex: 1; padding: 20px; overflow-x: hidden; }

.search-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px; 
}
.search-bar input[type="text"] { 
    flex-grow: 1; min-width: 200px; padding: 10px; border: 1px solid #ddd;
    border-radius: 5px; font-size: 1em; 
}

.create-folder-btn, .report-btn, .connect-domain-btn, .back-btn, .btn-primary { 
    padding: 10px 15px; color: #fff; border: none; border-radius: 5px;
    cursor: pointer; font-size: 0.95em; 
    width: auto; white-space: nowrap; text-transform: initial; 
    display: inline-flex; align-items: center; justify-content: center; 
    line-height: 1.5; text-decoration: none; /* For <a> styled as button */
}
.create-folder-btn i.fas, .report-btn i.fas, .connect-domain-btn i.fas, .back-btn i.fas, .btn-primary i.fas { 
    margin-right: 8px; 
}
.create-folder-btn { background-color: #007bff; }
.create-folder-btn:hover { background-color: #0056b3; }
.report-btn { background-color: #17a2b8; }
.report-btn:hover { background-color: #138496; }
.connect-domain-btn, .btn-primary { background-color: #28a745; } /* Using green for connect/primary action */
.connect-domain-btn:hover, .btn-primary:hover { background-color: #218838; }
.back-btn { background-color: #6c757d; }
.back-btn:hover { background-color: #5a6268; }

.nav-container { margin-bottom: 15px; margin-top: 15px; display: flex; align-items: center; font-size: 0.95em; }
.grid-container { background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1); margin-top: -10px; }
.grid {
    padding-top: 16px; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px;
}
.grid-item {
    position: relative; background-color: #f9f9f9; border: 1px solid #ddd;
    border-radius: 5px; padding: 10px; text-align: center;
    transition: transform 0.2s, box-shadow 0.2s; z-index: 1;
    display: flex; flex-direction: column; 
}
.grid-item:hover { transform: translateY(-5px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.grid-item-image { width: 100%; height: 180px; object-fit: contain; border-radius: 4px; margin-bottom: 10px; background-color: #e9ecef; }
.grid-item .settings-icon {
    position: absolute !important; top: 8px !important; right: 8px !important;
    left: auto !important; margin: 0 !important; background: rgba(255, 255, 255, 0.7); 
    border: none; border-radius: 50%; cursor: pointer; font-size: 1em;     
    color: #555; width: 30px; height: 30px;       
    display: flex; align-items: center; justify-content: center;
    padding: 0; text-transform: initial; z-index: 10; 
}
.grid-item .settings-icon:hover { background: rgba(230, 230, 230, 0.9); color: #000; }
.grid-item .settings-icon i { display: block; padding: 0; margin: 0; line-height: 1; }
.asset-info { display: flex; flex-direction: column; align-items: center; margin-top: auto; width: 100%; }
.asset-name {
    font-size: 0.95em; font-weight: 500; margin: 5px 0; word-break: break-all; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    width: calc(100% - 10px); color: #333;
}
.asset-details { display: flex; align-items: center; justify-content: space-around; flex-wrap: wrap; gap: 8px; margin-top: 8px; margin-bottom: 5px; width: 100%; flex-wrap: wrap; }
.file-size { font-size: 0.85em; color: #777; }
.copy-link-btn, .open-link-btn {
    padding: 6px 12px; background-color: #007bff; color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 0.85em; 
    white-space: nowrap; text-align: center; text-transform: initial; 
    flex-grow: 1; min-width: 70px; flex-basis: 100px;
}
.copy-link-btn:hover, .open-link-btn:hover { background-color: #0056b3; }
.grid-item.folder-item .asset-name { font-weight: bold; }
.grid-item.folder-item .file-size { color: #007bff; }
.grid-item.has-dropdown { z-index: 1001; } 
.dropdown, .folder-dropdown {
    position: absolute; top: 35px; right: 5px; background-color: #fff;
    border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1002; min-width: 140px; padding: 5px 0; 
}
.dropdown ul, .folder-dropdown ul { list-style: none; padding: 0; margin: 0; }
.dropdown li, .folder-dropdown li { padding: 8px 12px; cursor: pointer; white-space: nowrap; font-size: 0.9em; position: relative; display: flex; align-items: center; }
.dropdown li:hover, .folder-dropdown li:hover { background-color: #f0f0f0; }
.dropdown ul li i, .folder-dropdown ul li i { margin-right: 8px; width: 16px; text-align: center; }
.move-option { padding-bottom: 10px !important; position: relative; }
.folder-list {
    display: none; position: absolute; top: calc(100% - 10px); left: 0; 
    background-color: #fff; border: 1px solid #ddd; border-top: 1px solid #eee; 
    border-radius: 0 0 4px 4px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 
    min-width: 100%; z-index: 1005; padding: 5px 0;
}
.move-option:hover > .folder-list, .move-option > .folder-list:hover { display: block; }
.folder-list li { padding: 8px 12px; font-size: 0.9em; pointer-events: auto; }
.folder-list li:hover { background-color: #f0f0f0; }

.upload-square { 
    border: 2px dashed #007bff; border-radius: 10px; padding: 30px 20px; 
    text-align: center; cursor: pointer; transition: background-color 0.2s;
    background: #f8f9fa; display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 100px; margin-bottom: 15px;
}
.upload-square:hover { background-color: #e9ecef; }
.upload-square.dragover { background-color: #d4edda; border-color: #28a745; }
.upload-icon { font-size: 2.5em; color: #007bff; margin-bottom: 15px; }
.upload-text-main { font-size: 1.1em; font-weight: 500; margin-bottom: 8px; }
.upload-text-sub { font-size: 0.85em; color: #6c757d; }

.loading-animation { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.spinner { 
    border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%;
    width: 30px; height: 30px; animation: spin 1s linear infinite; margin-bottom: 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Modal Styles (Report & Custom Domain) --- */
.modal { 
    display: none; position: fixed; z-index: 10000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); 
}
.modal-content { /* General modal content styling */
    background-color: #fefefe; margin: 5% auto; padding: 25px 30px; 
    border: 1px solid #bbb; width: 90%; max-width: 650px; /* Default for report modal */
    border-radius: 8px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close-modal-btn, .close-report-modal { /* Unified close button style */
    color: #777; position: absolute; top: 10px; right: 15px;
    font-size: 28px; font-weight: bold; line-height: 1; cursor: pointer;
    padding: 0; background: none; border: none;
}
.close-modal-btn:hover, .close-modal-btn:focus,
.close-report-modal:hover, .close-report-modal:focus { color: #333; text-decoration: none; }

/* Specifics for Custom Domain Modal */
.custom-domain-modal-content { max-width: 750px; text-align: left; }
.custom-domain-modal-content h2, .modal-content h2 { /* Shared h2 style for modals */
    text-align: center; margin-top: 0; margin-bottom: 25px;
    font-size: 1.6em; color: #333;
}
.modal-step { padding: 10px 0; line-height: 1.6; }
.modal-step p { margin-bottom: 15px; }
.modal-step ol, .modal-step ul { margin-bottom: 20px; padding-left: 25px; }
.modal-step ol li, .modal-step ul li { margin-bottom: 10px; }
.modal-step code { background-color: #e9ecef; padding: 3px 6px; border-radius: 4px; font-family: monospace; color: #c7254e; font-size: 0.9em; }
.modal-step small { font-size: 0.875em; color: #6c757d; display: block; margin-top: 8px; }
.modal-step strong { font-weight: 600; }

/* General button styling within modals */
.modal-content .button { 
    padding: 10px 20px; color: white; border: none; border-radius: 5px;
    cursor: pointer; font-size: 1em; text-transform: none; 
    display: inline-flex; align-items: center; justify-content: center;
    margin: 5px; transition: background-color 0.2s ease;
}
.modal-content .button:disabled { background-color: #ccc; cursor: not-allowed; }

/* Default/Primary modal button (e.g. "Next", "Generate", "Request Connection") */
.modal-content .button, 
#customDomainModal .button { 
    background-color: #007bff; 
}
.modal-content .button:hover:not(:disabled),
#customDomainModal .button:hover:not(:disabled) {
    background-color: #0056b3;
}
/* Secondary button (e.g. "Back") */
.modal-content .button-secondary { background-color: #6c757d;}
.modal-content .button-secondary:hover:not(:disabled) { background-color: #5a6268; }

/* Specific for report modal export button if needed */
.modal-content button#exportReportBtn { background-color: #17a2b8; }
.modal-content button#exportReportBtn:hover:not(:disabled) { background-color: #138496; }


#customDomainFormMsg { margin-top: 15px; font-size: 0.9em; min-height: 1.2em; text-align: center; font-weight: 500;}
#customDomainModal .form-group, #reportModal .form-group { /* Shared form-group style for modals */
    margin-bottom: 20px; text-align: left; 
}
#customDomainModal .form-group label, #reportModal .form-group label { 
    display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.95em; 
}
#customDomainModal .form-group input[type="text"], 
#reportModal .form-group input[type="text"] { /* Added reportModal for consistency if it has text inputs */
    width: 100%; padding: 10px; border: 1px solid #ccc; 
    border-radius: 4px; box-sizing: border-box; font-size: 1em;
}
#customDomainModal .form-group small, #reportModal .form-group small { 
    font-size: 0.85em; color: #6c757d; display: block; margin-top: 6px; 
}

/* Select element styling for Report Modal */
.modal-content select#reportTimeFrame { /* More specific for the report time frame select */
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95em; 
    background-color: #fff; 
    height: auto; /* Or specific height e.g. 40px */
    appearance: menulist; /* Or auto or none depending on desired styling */
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    line-height: 1.5; /* Ensure text is vertically centered */
}


/* Report Modal Chart & List Styles */
.modal-content .chart-container {
    position: relative; width: 100%; max-width: 580px; height: 280px;    
    margin: 15px auto 10px auto; padding: 10px;
    border: 1px solid #eee; border-radius: 4px; background-color: #f9f9f9;
}
#reportResultArea ul li { padding-bottom: 15px; margin-bottom: 15px; }
#reportResultArea ul li:last-child { border-bottom: none; margin-bottom: 0; }
#reportResultArea h3 {
    margin-top: 0; margin-bottom: 15px; font-size: 1.2em; color: #333;
    border-bottom: 1px solid #eee; padding-bottom: 10px;
}
#reportResultArea ul { list-style: none; padding-left: 0; }
#reportResultArea > ul > li { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px dashed #e0e0e0; }
#reportResultArea > ul > li:last-child { border-bottom: none; margin-bottom: 0; }
#reportResultArea strong { font-weight: 600; color: #444; }
#reportResultArea .location-list { padding-left: 15px; font-size: 0.95em; margin-top: 8px; list-style-type: disc; }
#reportResultArea .location-list li { margin-bottom: 4px; color: #555; }

/* Report Modal Checkbox Styles */
.checkbox-list-container {
    max-height: 150px; overflow-y: auto; border: 1px solid #ccc;
    padding: 10px; border-radius: 4px; background-color: #fff; 
}
.checkbox-item { display: flex; align-items: center; margin-bottom: 8px; }
.checkbox-item:last-child { margin-bottom: 0; }
.checkbox-item label { margin-left: 8px; font-weight: normal; font-size: 0.9em; cursor: pointer; flex-grow: 1; }
.checkbox-item input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    width: 18px; height: 18px; border: 2px solid #007bff; 
    border-radius: 3px; cursor: pointer; position: relative; 
    outline: none; vertical-align: middle; flex-shrink: 0; 
}
.checkbox-item input[type="checkbox"]:checked {
    background-color: #007bff; border-color: #007bff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: center; background-size: 60% 60%; 
}
.checkbox-item input[type="checkbox"]:checked::before { content: ''; display: none; }
#reportAssetCheckboxes p { font-style: italic; color: #6c757d; text-align: center; padding: 10px 0; }


/* --- Responsive Dashboard Styles --- */
.mobile-user-info {
    display: none; padding: 10px 15px; /* Adjusted padding */
    background-color: #007bff; color: #fff;
    justify-content: space-between; align-items: center;
    border-bottom: 1px solid #0056b3; 
}
.mobile-user-info .username-mobile { font-weight: bold; font-size: 0.95em; }
.mobile-user-info .logout-mobile {
    color: #fff; text-decoration: none; padding: 5px 10px;
    border-radius: 4px; background-color: rgba(255,255,255,0.1); 
    font-size: 0.9em;
}
.mobile-user-info .logout-mobile:hover { background-color: rgba(255,255,255,0.2); }
.mobile-user-info .account-settings-link i.fas { font-size: 1.1em; } /* If account settings icon is added here */


@media (max-width: 768px) {
    .sidebar { display: none; }
    .mobile-user-info { display: flex; }
    .content-wrapper { flex-direction: column; } /* Already here, good */
    main { width: 100%; padding: 15px; }
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-bar input[type="text"] { min-width: 0; margin-bottom: 10px; }
    .search-bar button, .search-bar .btn-primary { /* Ensure all buttons in search bar stack */
        width: 100%; margin-left: 0 !important; margin-bottom: 10px; 
    }
    .account-settings-link{ /* More specific selector if needed, or just .create-folder-btn */
        display: none; /* Hide the "Create Folder" button on mobile */
    }

    .search-bar button:last-child, .search-bar .btn-primary:last-child { margin-bottom: 0; }
    .upload-square { display: none !important; } 
    .grid { grid-template-columns: 1fr; gap: 15px; } /* Adjusted minmax */
    .grid-item { min-width: 0; }
    .grid-item-image { height: 160px; } /* Slightly smaller */
    .modal-content { margin: 8% auto; width: 95%; padding: 20px; } /* Adjusted margin */
    .custom-domain-modal-content { max-width: 95%; }
}

@media (max-width: 480px) {
    .login-container h2, 
    .modal-content h2 { font-size: 1.4em; } /* Slightly larger than 1.3 for titles */
    .custom-domain-modal-content h2 { font-size: 1.5em; } 
    .grid { grid-template-columns: 1fr; }
    .mobile-user-info { padding: 8px 12px; font-size: 0.9em; }
    .mobile-user-info .logout-mobile { padding: 4px 8px; }
    .modal-content .button,
    #customDomainModal .button,
    .btn-primary { font-size: 0.9em; padding: 8px 15px; } /* Adjusted padding */
    .custom-domain-modal-content { padding: 15px; }
    .login-container { padding: 25px 20px; } /* Less padding on very small screens */
}

/* Pour les écrans inférieurs à 1115px */
@media (max-width: 1115px) {
  .upload-square {
    /* background: #ff0 !important; */
    /* si je veux aussi que su grand ecrans (min-width: 1115px) il prend toute la grille alors il faut que je paste ceci plus haut  */
    grid-column: 1 / -1; /* Prend toute la largeur de la grille */
    width: 100% !important;
    box-sizing: border-box;
    margin-bottom: 15px;
    z-index: 1;
    position: relative;
  }
}

/* Pour les écrans très petits (mobile) */
@media (max-width: 835px) {
  .upload-square {
    width: 98% !important;
    min-width: 180px;
    font-size: 1.1em;
  }
}



/* ajout style pour les dossier actif du drag and drop */

.folder-item.drag-over {
    outline: 2px dashed #007bff;
    background: #eaf4ff;
    transition: background 0.2s, outline 0.2s;
}

.folder_view .create-folder-btn {
    display: none;