/* ========================================
   STYLES GLOBAUX - Gestionnaire de mots de passe
   ======================================== */

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ========================================
   NAVIGATION
   ======================================== */

.navbar {
    background: #667eea;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.navbar-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar h1 {
    font-size: 20px;
    margin: 0;
}

.navbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
}

.navbar a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background 0.3s;
    font-size: 14px;
}

.navbar a:hover {
    background: rgba(255,255,255,0.2);
}

/* ========================================
   CONTENEURS
   ======================================== */

.container {
    max-width: 1500px;
    margin: 20px auto;
    padding: 0 15px;
}

.section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h2 {
    font-size: 22px;
    color: #333;
}

/* ========================================
   LAYOUT ARBORESCENCE (INDEX)
   ======================================== */

.main-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    align-items: start;
}

.tree-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.content-panel {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.tree-header h3 {
    font-size: 16px;
    color: #333;
}

/* ========================================
   ARBORESCENCE DE DOSSIERS
   ======================================== */

.folder-item {
    margin: 5px 0;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.folder-header:hover {
    background: #f5f5f5;
}

.folder-header.active {
    background: #e7f3ff;
    color: #667eea;
    font-weight: bold;
}

.folder-header.shared {
    color: #FF9800;
}

.folder-icon {
    margin-right: 8px;
    font-size: 16px;
}

.folder-expand {
    margin-right: 5px;
    font-size: 12px;
    transition: transform 0.2s;
    cursor: pointer;
    width: 17px;
    display: inline-block;
    text-align: center;
}

.folder-expand.collapsed {
    transform: rotate(-90deg);
}

.folder-name {
    flex: 1;
    font-size: 14px;
}

.folder-count {
    font-size: 11px;
    color: #999;
    margin-left: 5px;
}

.folder-actions {
    display: none;
    gap: 5px;
}

.folder-header:hover .folder-actions {
    display: flex;
}

.folder-children {
    margin-left: 20px;
    display: none;
}

.folder-children.expanded {
    display: block;
}

/* ========================================
   FORMULAIRES
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input {
    width: auto;
}

/* ========================================
   BOUTONS
   ======================================== */

.btn {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
    font-size: 14px;
    text-align: center;
}

.btn:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #999;
}

.btn-secondary:hover {
    background: #777;
}

.btn-small {
    padding: 7px 11px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

.btn-view {
    background: #4CAF50;
    color: white;
}

.btn-edit {
    background: #2196F3;
    color: white;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-reset {
    background: #FF9800;
    color: white;
}

.btn-promote {
    background: #4CAF50;
    color: white;
}

.btn-demote {
    background: #FF9800;
    color: white;
}

.btn-add {
    background: #4CAF50;
    color: white;
}

.btn-edit-group {
    background: #FF9800;
    color: white;
}

.btn-small:hover {
    opacity: 0.8;
}

.btn-generate {
    padding: 10px 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    flex: 1;
    min-width: 120px;
}

.btn-generate:hover {
    background: #45a049;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

/* ========================================
   MESSAGES
   ======================================== */

.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
    font-size: 14px;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #3c3;
    font-size: 14px;
}

.warning {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid #ffc107;
}

.info-box {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border-left: 4px solid #2196F3;
    font-size: 14px;
}

.info-box p {
    color: #0066cc;
    margin: 5px 0;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

.badge-admin {
    background: #4CAF50;
    color: white;
}

.badge-user {
    background: #2196F3;
    color: white;
}

.badge-owner {
    background: #4CAF50;
    color: white;
}

.badge-editor {
    background: #2196F3;
    color: white;
}

.badge-member {
    background: #2196F3;
    color: white;
}

.badge-pending {
    background: #FF9800;
    color: white;
}

.badge-rejected {
    background: #999;
    color: white;
}

/* ========================================
   TABLEAUX
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

tr:hover {
    background: #f9f9f9;
}

/* ========================================
   LISTE DE MOTS DE PASSE
   ======================================== */

.password-list {
    margin-top: 20px;
}

.password-item {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 1.4fr 1fr 0.6fr auto;
    gap: 25px;
    align-items: center;
}

.password-item:last-child {
    border-bottom: none;
}

.password-item:hover {
    background: #f9f9f9;
}

.site-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.site-info strong {
    color: #333;
    font-size: 16px;
}

.site-info span {
    color: #666;
    font-size: 13px;
    word-break: break-all;
}

.password-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.password-field strong {
    font-size: 13px;
    color: #555;
}

.password-field span {
    font-family: monospace;
    font-size: 14px;
}

.actions {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 220px;
    justify-content: flex-end;
}

/* ========================================
   PROFIL
   ======================================== */

.profile-header {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: center;
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.profile-info h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.profile-info p {
    color: #666;
    margin: 5px 0;
    font-size: 14px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-item,
.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-item strong,
.stat-card h3 {
    display: block;
    font-size: 28px;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-item span,
.stat-card p {
    color: #666;
    font-size: 14px;
}

/* ========================================
   RECHERCHE
   ======================================== */

.search-bar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.results-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.results-info strong {
    color: #333;
}

/* ========================================
   ÉTATS VIDES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

/* ========================================
   MODAL
   ======================================== */

.modal,
.move-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.active,
.move-modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content,
.move-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s;
}

.modal-header,
.move-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3,
.move-modal-header h3 {
    color: #333;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-modal:hover {
    color: #333;
}

/* ========================================
   PAGES DE CONNEXION/INSCRIPTION
   ======================================== */

body.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container,
.register-container,
.pending-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1,
.register-container h1,
.pending-container h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 24px;
}

.register-link,
.login-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.register-link a,
.login-link a {
    color: #667eea;
    text-decoration: none;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #999;
}

.step.active {
    background: #667eea;
    color: white;
}

.code-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    font-weight: bold;
}

.icon {
    font-size: 80px;
    margin-bottom: 20px;
    text-align: center;
}

.success-icon {
    text-align: center;
    font-size: 60px;
    margin-bottom: 15px;
}

.links {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 10px;
}

.links a {
    color: #667eea;
    text-decoration: none;
}

.links a:hover {
    text-decoration: underline;
}

/* ========================================
   GÉNÉRATEUR DE MOT DE PASSE
   ======================================== */

.password-strength {
    margin-top: 10px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s;
    border-radius: 4px;
}

.strength-weak { 
    background: #f44336; 
}

.strength-medium { 
    background: #FF9800; 
}

.strength-good { 
    background: #4CAF50; 
}

.strength-strong { 
    background: #2196F3; 
}

.strength-text {
    margin-top: 5px;
    font-size: 13px;
    font-weight: bold;
}

.generator-options {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.option-group label {
    margin: 0;
    font-size: 14px;
}

.option-group input[type="checkbox"] {
    width: auto;
}

.option-group input[type="number"] {
    width: 80px;
    padding: 5px;
}

.password-generator {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.password-toggle {
    position: relative;
}

.toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

/* ========================================
   UTILITAIRES
   ======================================== */

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    margin-left: 5px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    vertical-align: middle;
}

.copy-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.copy-btn:active {
    transform: scale(0.95);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (min-width: 768px) {
    .navbar h1 {
        font-size: 24px;
    }
    
    .profile-header {
        padding: 30px;
        gap: 30px;
        margin-bottom: 30px;
    }
    
    .avatar {
        width: 100px;
        height: 100px;
        font-size: 48px;
    }
    
    .profile-info h2 {
        font-size: 24px;
    }
    
    .stat-card h3 {
        font-size: 36px;
    }
}

@media (max-width: 767px) {
    .navbar h1 {
        font-size: 18px;
        width: 100%;
        margin-bottom: 5px;
    }
    
    .navbar-right {
        width: 100%;
        justify-content: space-between;
        font-size: 13px;
    }
    
    .navbar-right span {
        display: none;
    }
    
    .navbar a {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .container {
        margin: 15px auto;
        padding: 0 10px;
    }
    
    .section {
        padding: 20px;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header h2 {
        font-size: 20px;
    }
    
    .btn {
        width: 100%;
    }
    
    .search-bar {
        padding: 15px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
        min-width: auto;
    }
    
    .password-item {
        padding: 15px;
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .site-info strong {
        font-size: 15px;
    }
    
    .actions {
        flex-direction: column;
        width: 100%;
    }
    
    .actions .btn-small {
        width: 100%;
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .tree-panel {
        position: static;
        max-height: none;
    }
    
    .profile-header {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
        padding: 20px;
    }
    
    .stats {
        width: 100%;
    }
    
    table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 8px;
    }
    
    .login-container,
    .register-container,
    .pending-container {
        padding: 30px 20px;
    }
    
    .login-container h1,
    .register-container h1,
    .pending-container h1 {
        font-size: 22px;
        margin-bottom: 25px;
    }
    
    .code-input {
        font-size: 20px;
        letter-spacing: 5px;
    }
    
    .icon {
        font-size: 60px;
    }
    
    .modal-content,
    .move-modal-content {
        padding: 25px 20px;
    }
    
    .badge {
        margin-left: 0;
        margin-top: 5px;
        display: inline-block;
    }
    
    .password-generator {
        flex-direction: column;
    }
    
    .btn-generate {
        width: 100%;
        min-width: auto;
    }
}