/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:    #4f46e5;
    --primary-d:  #3730a3;
    --secondary:  #6b7280;
    --success:    #10b981;
    --danger:     #ef4444;
    --warning:    #f59e0b;
    --bg:         #f1f5f9;
    --card:       #ffffff;
    --text:       #1e293b;
    --text-light: #64748b;
    --border:     #e2e8f0;
    --radius:     12px;
    --shadow:     0 4px 24px rgba(0,0,0,.08);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ─── Navbar ────────────────────────────────────────────────── */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: .875rem 2rem;
    display: flex; align-items: center; gap: 1.5rem;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.navbar-brand { font-weight: 700; font-size: 1.2rem; color: var(--primary); }
.navbar-links { display: flex; gap: .5rem; flex: 1; }
.nav-link { text-decoration: none; padding: .5rem .875rem; border-radius: 8px; color: var(--text-light); transition: all .2s; font-size: .9rem; }
.nav-link:hover { background: var(--bg); color: var(--primary); }
.navbar-user { display: flex; align-items: center; gap: 1rem; }
.pole-chip { background: var(--primary); color: #fff; padding: .35rem .875rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }

/* ─── Container ─────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--text-light); margin-top: .25rem; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }

/* ─── Auth Page ─────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.auth-container { width: 100%; max-width: 440px; padding: 1.5rem; }
.auth-card { background: var(--card); border-radius: 20px; padding: 2.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 1rem; }
.auth-card h1 { text-align: center; font-size: 1.4rem; margin-bottom: .25rem; }
.auth-subtitle { text-align: center; color: var(--text-light); margin-bottom: 2rem; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .7rem 1rem; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: .95rem; transition: border .2s; background: #fff; color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-password { position: relative; }
.input-password input { padding-right: 3rem; }
.toggle-password { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; }
.required { color: var(--danger); }

/* ─── Checkboxes ─────────────────────────────────────────────── */
.checkboxes-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .75rem 0; }
.checkboxes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; margin-top: .5rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; padding: .5rem .75rem; border: 1.5px solid var(--border); border-radius: 8px; transition: all .2s; }
.checkbox-label:hover { border-color: var(--primary); background: #f0f0ff; }
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--primary); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.5rem; border-radius: 8px; font-size: .95rem; font-weight: 600; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); transform: translateY(-1px); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .4rem 1rem; font-size: .85rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: .25rem; border-radius: 6px; transition: background .2s; }
.btn-icon:hover { background: var(--bg); }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: .85rem; text-decoration: underline; margin-top: .5rem; }

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert { padding: .875rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ─── Stats & Actions ───────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 1.5rem; display: flex; align-items: center; gap: 1rem; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-icon { font-size: 2.5rem; }
.stat-info h3 { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-info p { color: var(--text-light); font-size: .875rem; }
.quick-actions h2, .recent-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.action-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-decoration: none; color: var(--text); transition: all .2s; }
.action-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.action-icon { font-size: 2rem; display: block; margin-bottom: .75rem; }
.action-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.action-card p { font-size: .85rem; color: var(--text-light); }

/* ─── Tables ─────────────────────────────────────────────────── */
.password-table-wrapper { overflow-x: auto; }
.password-table { width: 100%; border-collapse: collapse; }
.password-table th { background: var(--bg); padding: .75rem 1rem; text-align: left; font-size: .85rem; font-weight: 600; color: var(--text-light); border-bottom: 2px solid var(--border); }
.password-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.password-table tr:hover td { background: #f8fafc; }
.keyword-badge { background: #e0e7ff; color: var(--primary); padding: .25rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.password-cell { display: flex; align-items: center; gap: .4rem; }
.password-hidden { font-family: monospace; letter-spacing: 2px; color: var(--text-light); }
.description-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Pole Badges ────────────────────────────────────────────── */
.pole-badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; margin: 2px; }
.pole-business      { background: #dbeafe; color: #1e40af; }
.pole-technique     { background: #d1fae5; color: #065f46; }
.pole-communication { background: #fce7f3; color: #9d174d; }
.pole-design        { background: #ede9fe; color: #5b21b6; }
.pole-financier     { background: #fef3c7; color: #92400e; }
.pole-client        { background: #e0f2fe; color: #0c4a6e; }

/* ─── Generator ─────────────────────────────────────────────── */
.generator-section { margin-bottom: 1.5rem; }
.generator-controls { background: var(--bg); border-radius: 10px; padding: 1.5rem; margin-top: 1rem; }
.generated-result { margin-top: 1rem; }
.generated-password-display { display: flex; align-items: center; gap: 1rem; background: #1e293b; padding: 1rem 1.25rem; border-radius: 10px; }
.generated-password-display code { flex: 1; color: #4ade80; font-size: 1.1rem; font-family: 'Courier New', monospace; word-break: break-all; }
.strength-bar { height: 8px; background: var(--border); border-radius: 999px; margin-top: .75rem; overflow: hidden; }
#strength_fill { height: 100%; border-radius: 999px; transition: width .3s, background .3s; }

/* ─── Search ─────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 1rem; }
.search-bar input { flex: 1; padding: .875rem 1.25rem; border: 1.5px solid var(--border); border-radius: 10px; font-size: 1rem; }
.search-bar input:focus { outline: none; border-color: var(--primary); }
.no-results { text-align: center; padding: 3rem; color: var(--text-light); }
.no-results span { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ─── Tab Switch ─────────────────────────────────────────────── */
.tab-switch { display: flex; gap: .5rem; margin-top: 1rem; }
.tab { padding: .5rem 1rem; border-radius: 8px; text-decoration: none; color: var(--text-light); border: 1.5px solid var(--border); font-size: .9rem; transition: all .2s; }
.tab.active, .tab:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Form Actions ───────────────────────────────────────────── */
.form-actions { display: flex; gap: 1rem; justify-content: flex-end; padding-top: 1.5rem; border-top: 1px solid var(--border); margin-top: 1.5rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 2rem; right: 2rem; background: #1e293b; color: #fff; padding: .875rem 1.5rem; border-radius: 10px; font-size: .9rem; z-index: 9999; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar { padding: .875rem 1rem; flex-wrap: wrap; }
    .navbar-links { order: 3; width: 100%; overflow-x: auto; }
    .form-row { grid-template-columns: 1fr; }
    .search-bar { flex-direction: column; }
    .form-actions { flex-direction: column; }
}
