/* ============================================================
   PASSWORD MANAGER — Feuille de style principale
   Couleurs : #5cb85c (vert principal), #4cae4c (vert foncé), blanc
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:      #5cb85c;
    --green-dark: #4cae4c;
    --green-light:#eaf6ea;
    --white:      #ffffff;
    --gray-100:   #f8f9fa;
    --gray-200:   #e9ecef;
    --gray-400:   #ced4da;
    --gray-600:   #6c757d;
    --gray-800:   #343a40;
    --red:        #d9534f;
    --red-dark:   #c9302c;
    --yellow:     #f0ad4e;
    --radius:     6px;
    --shadow:     0 2px 8px rgba(0,0,0,.10);
    --shadow-lg:  0 4px 20px rgba(0,0,0,.15);
    --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    font-size: 15px;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
    background: var(--green);
    color: white;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
    color: white;
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-user {
    color: rgba(255,255,255,.9);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- CONTAINER ---- */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 20px;
}
.container-sm { max-width: 640px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }

.btn-primary  { background: var(--green);  color: white; }
.btn-primary:hover { background: var(--green-dark); opacity: 1; }
.btn-danger   { background: var(--red);    color: white; }
.btn-danger:hover { background: var(--red-dark); opacity: 1; }
.btn-outline  { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,.7); }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-block    { width: 100%; justify-content: center; }
.btn-sm       { padding: 5px 12px; font-size: 13px; }
.btn-icon     { background: none; border: none; cursor: pointer; color: var(--gray-600); padding: 2px 4px; border-radius: 3px; }
.btn-icon:hover { color: var(--green-dark); background: var(--green-light); }

/* Outline sur fond blanc */
.card .btn-outline, .login-form .btn-outline,
.form-actions .btn-outline {
    border-color: var(--gray-400);
    color: var(--gray-800);
}
.card .btn-outline:hover, .form-actions .btn-outline:hover {
    background: var(--gray-200);
}

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert p { margin: 0; }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}
.badge-admin    { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green); }
.badge-user     { background: #e3f0ff; color: #1a56a0; border: 1px solid #b8d4f8; }
.badge-active   { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-inactive { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.badge-reader   { background: var(--gray-200); color: var(--gray-600); font-size: 11px; }

/* ---- LOGIN PAGE ---- */
.login-page {
    background: linear-gradient(135deg, #eaf6ea 0%, #d0ecd0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-container {
    background: white;
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 {
    margin-top: 12px;
    font-size: 22px;
    color: var(--gray-800);
}
.login-form .btn-primary {
    margin-top: 8px;
    padding: 12px;
    font-size: 16px;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-800);
}
.form-group label small {
    font-weight: 400;
    color: var(--gray-600);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select,
.search-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-400);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font);
    background: white;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.search-form input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(92,184,92,.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-check label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); }

.input-password-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}
.input-password-wrap input { flex: 1; }
.toggle-pw {
    background: none;
    border: 1.5px solid var(--gray-400);
    border-radius: var(--radius);
    padding: 7px 10px;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    transition: border-color .15s;
}
.toggle-pw:hover { border-color: var(--green); color: var(--green-dark); }

.pw-strength {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

/* ---- TOOLBAR ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    max-width: 480px;
}
.search-form input {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-400);
    border-radius: var(--radius);
    font-size: 14px;
}

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}
.table th {
    background: var(--green);
    color: white;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.table th:first-child { border-radius: var(--radius) 0 0 0; }
.table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--green-light); }
.table tbody tr:last-child td { border-bottom: none; }
.td-remark { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gray-600); font-size: 13px; }
.th-actions, .td-actions { text-align: right; white-space: nowrap; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.text-muted { color: var(--gray-600); font-size: 13px; }

/* ---- PASSWORD CELL ---- */
.pw-cell { display: flex; align-items: center; gap: 6px; }
.pw-dots { letter-spacing: 3px; font-size: 16px; color: var(--gray-600); }
.pw-plain { font-family: monospace; font-size: 13px; }
.copy-field { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.copy-field:hover { color: var(--green-dark); }
.icon-copy { opacity: 0; transition: opacity .15s; }
.copy-field:hover .icon-copy { opacity: 1; }

/* ---- CARD ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    background: var(--green);
    color: white;
    padding: 14px 20px;
}
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.card form { padding: 20px; }

/* ---- TWO COLUMN LAYOUT ---- */
.two-col { display: flex; gap: 24px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; }
.col-side { width: 360px; flex-shrink: 0; }
.col-side h2 { margin-bottom: 16px; }
.col-main h2 { margin-bottom: 16px; }

/* ---- MODAL ---- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: white;
    border-radius: 10px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 12px; }
.modal-box p { margin-bottom: 20px; color: var(--gray-600); }
.modal-actions { display: flex; gap: 10px; }

/* ---- TOAST ---- */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: var(--shadow);
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--gray-600);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-state p { margin-top: 16px; font-size: 16px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .two-col { flex-direction: column; }
    .col-side { width: 100%; }
}
@media (max-width: 600px) {
    .navbar { padding: 0 12px; }
    .container { padding: 16px 12px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-form { max-width: 100%; }
    .login-container { padding: 32px 24px; }
}

/* ---- URL FIELD ---- */
.input-url-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}
.input-url-wrap input {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-400);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font);
    background: white;
    transition: border-color .15s;
}
.input-url-wrap input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(92,184,92,.15);
}
.input-url-wrap .btn {
    border-color: var(--gray-400);
    color: var(--gray-800);
    background: transparent;
    flex-shrink: 0;
}
.input-url-wrap .btn:hover { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }

.url-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--green-dark);
    font-size: 13px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.url-link:hover { text-decoration: underline; }
