/* ========================================
   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: 1200px;
    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;
}

/* ========================================
   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"],
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: 8px 16px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    margin: 0 3px;
}

.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;
}

/* ========================================
   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;
}

/* ========================================
   CARTES
   ======================================== */

.password-item {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.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: 14px;
    color: #555;
}

.password-field span {
    font-family: monospace;
    font-size: 14px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================
   GROUPES
   ======================================== */

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.group-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.group-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.group-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 18px;
}

.group-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.group-stats {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    font-size: 13px;
    color: #888;
}

.group-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.group-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* ========================================
   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;
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #667eea;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination a:hover {
    background: #667eea;
    color: white;
}

.pagination .current {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

.pagination .disabled:hover {
    background: white;
    color: #ccc;
}

/* ========================================
   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 {
    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 {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
    animation: slideUp 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.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;
}

/* ========================================
   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);
}

.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;
}

.password-generator {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.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;
}

/* ========================================
   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);
    }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (min-width: 768px) {
    .navbar h1 {
        font-size: 24px;
    }
    
    .password-item {
        grid-template-columns: 1fr 1fr 1fr auto;
        align-items: center;
    }
    
    .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;
    }
    
    .site-info strong {
        font-size: 15px;
    }
    
    .actions .btn-small {
        flex: 1;
        min-width: 70px;
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .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 {
        padding: 25px 20px;
    }
    
    .group-actions {
        flex-direction: column;
    }
    
    .group-actions .btn-small {
        width: 100%;
    }
    
    .badge {
        margin-left: 0;
        margin-top: 5px;
        display: inline-block;
    }
}