/* Form Elements */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .form-control:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}
.form-control {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
@media (min-width: 768px) {
    .modal-overlay { align-items: center; }
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 540px;
    border-radius: 28px 28px 0 0;
    padding: 28px;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 92vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
@media (min-width: 768px) {
    .modal-content {
        border-radius: 28px;
        box-shadow: var(--shadow-xl);
    }
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.full-width {
    width: 100%;
}

/* Search Overlay */
.search-overlay {
    background: var(--surface);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 60;
    display: none;
    flex-direction: column;
}
.search-overlay.active {
    display: flex;
    animation: fadeIn 0.2s;
}
.search-box {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    gap: 15px;
}
.search-box i {
    font-size: 24px;
    color: var(--text-muted);
}
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-primary);
    outline: none;
}
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.search-category {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    margin: 20px 0 10px;
    letter-spacing: 0.5px;
}
.search-category:first-of-type {
    margin-top: 0;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 5px;
}
.search-item:hover {
    background: rgba(79, 70, 229, 0.05);
    transform: translateX(5px);
}
.search-icon {
    width: 40px;
    height: 40px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.search-info {
    display: flex;
    flex-direction: column;
}
.search-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}
.search-meta {
    font-size: 12px;
    color: var(--text-muted);
}


/* List Items (Clients, Abonnements, etc.) */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.list-item {
    background: var(--surface);
    padding: 18px 20px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.list-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border-color: var(--primary);
}
.item-info h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.item-info p {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.item-actions {
    display: flex;
    gap: 10px;
}
.btn-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-icon:hover {
    transform: scale(1.1);
}
.btn-icon.action {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
}
.btn-icon.action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.btn-icon.whatsapp {
    background: rgba(16, 185, 129, 0.08);
    color: var(--secondary);
    border-color: rgba(16, 185, 129, 0.2);
}
.btn-icon.whatsapp:hover {
    background: var(--secondary);
    color: white;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge.actif { background: var(--secondary-light); color: var(--secondary); }
.badge.suspendu { background: var(--danger-light); color: var(--danger); }
.badge.expire { background: var(--warning-light); color: var(--warning); }
.badge.paye { background: var(--secondary-light); color: var(--secondary); }
.badge.en_attente { background: rgba(100,116,139,0.1); color: var(--text-muted); }
.badge.non_paye { background: var(--danger-light); color: var(--danger); }
.badge.pas_encore_retire { background: var(--primary-light); color: var(--primary); }
.badge.deleted { background: rgba(15,23,42,0.85); color: white; }
.badge.non_serieux { background: #000; color: #fff; }
.badge.archived { background: rgba(100,116,139,0.15); color: #475569; }
.badge.annule { background: var(--danger-light); color: #b91c1c; }

.row-muted {
    opacity: 0.5;
    filter: grayscale(1);
    transition: opacity 0.3s;
}
.row-muted:hover {
    opacity: 0.8;
}

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}
.pill {
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}
.pill.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.view-header h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.btn-secondary {
    padding: 10px 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

/* Section Title */
.section-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-main);
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 24px;
    border: 1.5px solid var(--border);
}
.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.tab:hover {
    color: var(--primary);
}
.tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}
.mt-3 { margin-top: 20px; }

/* Pagination */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 0;
    flex-wrap: wrap;
}
.pagination-container span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 10px;
}

/* Modern Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    border: 1.5px solid var(--border);
}
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.modern-table thead tr {
    background: var(--bg-main);
}
.modern-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}
.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}
.modern-table tbody tr:last-child td {
    border-bottom: none;
}
.modern-table tbody tr {
    transition: all 0.2s;
}
.modern-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}
.modern-table tbody tr.row-muted {
    opacity: 0.5;
    filter: grayscale(0.4);
}
.modern-table tbody tr.row-muted:hover {
    opacity: 0.75;
    filter: grayscale(0);
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    width: auto;
    min-width: 280px;
    max-width: 380px;
}
@media (min-width: 768px) {
    #toast-container { bottom: 30px; left: auto; right: 30px; transform: none; }
}
.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-success { border-color: var(--secondary); }
.toast-error { border-color: var(--danger); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Autocomplete Wrapper */
.autocomplete-wrapper {
    position: relative;
}
.suggestions-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    animation: fadeIn 0.15s ease;
}
.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.suggestion-item:first-child { border-radius: 14px 14px 0 0; }
.suggestion-item:last-child { border-radius: 0 0 14px 14px; }
.suggestion-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Abo Device Row */
.abo-device-row {
    background: var(--surface-2, rgba(0,0,0,0.02));
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    transition: border-color 0.2s;
}
.abo-device-row:hover {
    border-color: var(--primary);
}
.abo-device-row .btn-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--danger);
    cursor: pointer;
    font-size: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.abo-device-row .btn-remove:hover {
    opacity: 1;
}

.minimal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.minimal-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    align-items: center;
}
.minimal-list li:last-child {
    border-bottom: none;
}
.minimal-list li .badge {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 6px;
}
