* {
    box-sizing: border-box;
}
body {
    position:relative;
    font-family: Arial, sans-serif;
    padding: 20px;
    background-color: #ddd;
    background-color: #f4f4f9;
    max-width: 1200px;
    margin: auto;
    box-sizing: border-box;
}
h1 {
    text-align: center;
    color: #333;
}
#title {
    font-size: 1.5em;
    text-decoration: none;
    color: #007bff;
}

#folders-list{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.folder, .bookmark {
    display: inline-block;
    position: relative;
    padding: 10px;
    padding: 0.4em;
    margin: 5px;
    border: 1px solid #ccc;
    cursor: pointer;
    width: 100px;
    max-width: 100px;
    transition: background-color 0.7s, transform 0.7s;
}
.folder {
    background-color: #f0f0f0;
    min-height: 2em;
    height: 3em;
    width: calc(33.333% - 20px);
    width: 33.333% ;
    align-content: center;
    text-align: center;
    box-sizing: border-box;
}
.folder:hover{
    background-color: #d0d0d0;
    transform: scale(1.05);
}
.folder.dragOver {
    background-color: #d0d0d0;
}
.bookmark {
    background-color: #d4edda;
    background-color: #e6f7ff;
    display: inline-flex;
    flex-direction: column;
    height: 75px;
    width: calc(33.333% - 20px);
    width: 33.333%;
    box-sizing: border-box;
    max-height: 150px;
    max-width: 150px;
    height: 130px;
    position: relative;
}
.bookmark a {
    color: #007bff;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: absolute;
    bottom: 3px;
    left: 5px;
    max-width: calc(100% - 10px);
}
.bookmark span {
    max-height: calc(100% - 1em);
    overflow: hidden;
    word-wrap: break-word;
    text-overflow: ellipsis;
    text-indent: 1em;
}
.icon {
    display: inline-block;
    position: absolute;
    left: 1px;
    top: 1px;
    max-width: 24px;
    margin-bottom: 10px;
}
.dropzone {
    border: 2px dashed #aaa;
    padding: 10px;
    margin: 5px;
    text-align: center;
}
.edit-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
.edit-menu input, .edit-menu textarea {
    display: block;
    margin-bottom: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.edit-menu textarea {
    height: 17em;
    font-size: 0.9em;
}
.edit-menu button {
    margin-right: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.7s;
}
.edit-menu button:hover {
    background-color: #0056b3;
    color: white;
}
button{
    padding: 0.3em 0.6em;
    margin: 0.2em 0;
    border: none;
    border-radius: 0.2em;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}
button:hover {
    background-color: #0056b3;
}
#nouveaux-elements:not(.visible) {
    display: none;
}
#nouveaux-elements {
    display:flex;
    gap: 4em;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 1em 1em;
    padding-bottom: 1.5em;
    width: calc( 100% - 2px );
    width: 100%;
    border: 1px solid #444;
    background-color: inherit;
    z-index: 2;
    box-sizing: border-box;
    flex-wrap: wrap;
    justify-content: center;
    background-color: #ccc;
}
#nouveaux-elements-ouvrir, #nouveaux-elements-fermer {
    position: absolute;
    top: 1em;
    padding: 0.5em 1em;
}
#nouveaux-elements-ouvrir {
    left: 1em;
}
#nouveaux-elements-fermer {
    right: 1em;
}
#nouveaux-elements input {
    width: 100%;
    padding: 0.2em;
    margin: 0.3em 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}
#import-button-label {
    border:1px solid black;
    border-radius:0.15em;
    background-color:#eaeaea;
    padding:0.1em 0.5em;
    font-size:0.9em;
    cursor:pointer;
    transition: background-color 0.3s;
}
#import-button-label:hover {
    background-color: #e9e9e9;
}
#search {
    transition: transform 0.5s ease;
}
#search:focus {
    transform: scale(1.1);
}
@media (max-width:768px){
    body {
        padding: 0.1em;
    }
    h2 {
        max-height:0;
        overflow: hidden;
    }
    #folders-list {
        max-height: 200px !important;
        overflow-y: auto !important;
        border: 1px solid black;
        border-radius: 5px;
        flex-direction: column;
        align-items: center;
    }
    .folder {
        font-size: 0.7em;
        padding: 5px;
        margin: 2px;
        margin: 0;
        max-width: min( 90px, 30vw );
    }
    .bookmark {
        height: 90px;
    }
    .bookmark span {
        font-size: 0.7em;
    }
    .bookmark a {
        font-size: 0.7em;
        white-space: wrap;
        max-height: 2.5em;
    }
    .bookmark .icon {
        top: -8px;
        left: -8px;
        max-width: 20px;
    }
    .edit-menu {
        width: 90%;
    }
}




/***** Menu de synchronisation *****/
.sync-bar {
    background: #f0f0f0;
    padding: 8px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

.sync-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-controls button {
    padding: 4px 8px;
    border: 1px solid #ccc;
    /*background: white;*/
    cursor: pointer;
    border-radius: 3px;
}

.sync-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px;
    border-radius: 4px;
    z-index: 1000;
}

.message.success { background: #d4edda; color: #155724; }
.message.error { background: #f8d7da; color: #721c24; }

/* test de simplification */
#folders-title {
    cursor: pointer;
}
#folders-list {
    /* pour fermer le menu par défaut en mode bureau */
    overflow-y: hidden;
    max-height: 0.01em;
}
#folders-title.active + #folders-list {
    max-height: 10em;
    overflow: auto;
}
body.authlib-logged-in #show-login-button,
body:not(.authlib-logged-in) .sync-bar {
    display: none;
}

.label-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}

.danger {
    background-color: #dc3545;
    color: white;
}
.danger:hover {
    background-color: #c82333;
}


/* Modal de connexion */
.login-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.login-modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid #eee;
}

.login-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.login-form {
    padding: 25px;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
}

.login-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.login-message {
    padding: 10px 25px 20px;
    margin: 0;
    border-radius: 6px;
    display: none;
}

.login-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.login-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal de synchronisation */
.sync-prompt-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.sync-prompt-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.sync-header {
    text-align: center;
    margin-bottom: 20px;
}

.sync-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.3em;
}

.sync-header p {
    margin: 0;
    color: #666;
}

.sync-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sync-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sync-option:hover {
    border-color: #007bff;
    background: #f8f9ff;
    transform: translateY(-1px);
}

.sync-option.secondary:hover {
    border-color: #6c757d;
    background: #f8f9fa;
}

.option-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.option-content strong {
    display: block;
    color: #333;
    margin-bottom: 2px;
}

.option-content small {
    color: #666;
    font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .login-modal-content,
    .sync-prompt-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .login-actions {
        flex-direction: column;
    }
}