/* TAVU Gestion v2.1 - Design sobre */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --text: #1d1d1b;
    --text-light: #6c757d;
    --border: #e9ecef;
    --accent: #1d1d1b;
    --success: #28a745;
    --danger: #dc3545;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { opacity: 0.7; }

/* LOGIN */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.login-container { width: 100%; max-width: 380px; padding: 20px; }
.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo svg { height: 40px; width: auto; }

.login-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 40px;
}

.login-box h1 { font-size: 20px; font-weight: 600; margin-bottom: 24px; text-align: center; }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(29, 29, 27, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: #333; border-color: #333; }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-secondary); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 13px; transition: opacity 0.3s; }
.alert-danger { background: #fee; color: var(--danger); border: 1px solid #fcc; }
.alert-success { background: #efe; color: var(--success); border: 1px solid #cfc; }

/* NAVBAR */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.navbar-brand svg { height: 28px; width: auto; }

.navbar-nav { display: flex; align-items: center; gap: 24px; list-style: none; }
.navbar-nav a { font-size: 14px; font-weight: 500; color: var(--text-light); transition: color 0.2s; }
.navbar-nav a:hover, .navbar-nav a.active { color: var(--text); opacity: 1; }

.navbar-user { display: flex; align-items: center; gap: 12px; }
.navbar-user-name { font-size: 14px; font-weight: 500; color: var(--text); transition: opacity 0.2s; }
.navbar-user-name:hover { opacity: 0.7; }
.navbar-user-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* LAYOUT - Plus large */
.main-content { padding-top: 60px; min-height: 100vh; }
.container { max-width: 1600px; margin: 0 auto; padding: 40px 24px; }
.container-narrow { max-width: 1200px; }

/* PAGE HEADER */
.page-header { margin-bottom: 32px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 24px; font-weight: 600; }
.page-subtitle { color: var(--text-light); font-size: 14px; }

/* LINKS SECTION - Favicons plus grandes */
.links-section { margin-bottom: 48px; }
.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.link-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.link-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* Favicons plus grandes */
.link-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.link-card-icon img { width: 32px; height: 32px; object-fit: contain; }
.link-card-icon.has-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.link-card-icon svg { width: 24px; height: 24px; color: var(--text-light); }

.link-card-content { flex: 1; min-width: 0; }
.link-card-title { font-size: 15px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-card-desc { font-size: 12px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* CARDS & TABLES */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 20px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); background: var(--bg-secondary); }
.table tbody tr:hover { background: var(--bg-secondary); }
.table tbody tr:last-child td { border-bottom: none; }

/* Category sections in table */
.category-header {
    background: var(--bg-secondary);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-header::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

/* BADGES */
.badge { display: inline-block; padding: 4px 10px; font-size: 11px; font-weight: 500; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-admin { background: #1d1d1b; color: white; }
.badge-collaborateur { background: #e3f2fd; color: #1976d2; }
.badge-stagiaire { background: #f3e5f5; color: #7b1fa2; }
.badge-moi { background: #fff3e0; color: #e65100; }
.badge-success { background: #e8f5e9; color: #388e3c; }
.badge-warning { background: #fff3e0; color: #f57c00; }

/* MODALS */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-backdrop.active .modal { transform: translateY(0); }

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* DRAG & DROP */
.sortable-item {
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
}

.sortable-item:active { cursor: grabbing; }
.sortable-item.dragging { 
    opacity: 0.5; 
    background: var(--bg-secondary);
    transform: scale(1.02);
}

.sortable-ghost {
    opacity: 0.3;
    background: var(--accent);
}

.drag-handle {
    cursor: grab;
    padding: 8px;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.drag-handle:hover { color: var(--text); }
.drag-handle svg { width: 16px; height: 16px; }

/* UTILITIES */
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* PASSWORD */
.password-hidden { font-family: monospace; letter-spacing: 2px; color: transparent; text-shadow: 0 0 6px rgba(0,0,0,0.4); }
.password-visible { font-family: monospace; }

/* TOAST */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state-title { font-size: 16px; font-weight: 500; margin-bottom: 8px; color: var(--text); }

/* Password row in listing */
.password-row {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.password-row:last-child { border-bottom: none; }

.password-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.password-row-icon img { width: 24px; height: 24px; object-fit: contain; }

.password-row-content { flex: 1; min-width: 0; }
.password-row-title { font-weight: 500; margin-bottom: 2px; }
.password-row-url { font-size: 12px; color: var(--text-light); }
.password-row-credentials { font-size: 13px; margin-top: 4px; }

.password-row-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .navbar-nav { display: none; }
    .container { padding: 24px 16px; }
    .links-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

code { background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* Category select with "other" option */
.category-input-wrapper {
    position: relative;
}

.category-other-input {
    margin-top: 8px;
    display: none;
}

.category-other-input.visible {
    display: block;
}
