/* Design System - Calcul-Cost */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 100%);
    --card-bg: rgba(22, 28, 45, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.2);
    
    --success: #10b981;
    --success-hover: #059669;
    
    --warning: #f59e0b;
    --danger: #f43f5e;
    --danger-hover: #e11d48;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Layout */
.wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Navbar */
header {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 22px;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 8px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
}

.nav-links a:hover, 
.nav-links li.active a {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-links li.active a {
    border-left: 2px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: rgba(99, 102, 241, 0.08);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    color: #fff;
    display: block;
}

.user-role {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(99, 102, 241, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.btn-logout {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

/* Footer */
footer {
    background: rgba(17, 24, 39, 0.9);
    border-top: 1px solid var(--card-border);
    padding: 20px 0;
    margin-top: auto;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Main Dashboard Elements */
.page-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 20px 0;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--card-hover-border);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-top: 10px;
    margin-bottom: 5px;
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Auth Screens */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
    padding: 40px 0;
}

.auth-card {
    max-width: 420px;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(244, 63, 94, 0.1);
    color: #f87171;
    border-color: rgba(244, 63, 94, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 20px;
    background: rgba(22, 28, 45, 0.3);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

th {
    background: rgba(17, 24, 39, 0.8);
    color: #fff;
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #f87171;
}

/* Simulation Sheet Specific */
.simulation-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .simulation-grid {
        grid-template-columns: 1fr;
    }
}

.simulation-sheet {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.simulation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 15px;
}

.items-table th:nth-child(1) { width: 40%; } /* Article */
.items-table th:nth-child(2) { width: 15%; } /* Qty */
.items-table th:nth-child(3) { width: 15%; } /* Prix HT */
.items-table th:nth-child(4) { width: 20%; } /* Prix Revient */
.items-table th:nth-child(5) { width: 10%; } /* Action */

.row-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.row-action-btn:hover {
    color: var(--danger);
}

/* Add Row Button */
.btn-add-row {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px dashed var(--primary);
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-row:hover {
    background: var(--primary);
    color: #fff;
    border-style: solid;
}

.frais-card-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.frais-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.frais-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.frais-value-input {
    width: 120px;
    text-align: right;
}

/* Autocomplete/Dropdown style enhancements */
.autocomplete-container {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111827;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin-top: 4px;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.autocomplete-item:hover {
    background: var(--primary);
    color: #fff;
}

.autocomplete-item-new {
    border-top: 1px solid var(--card-border);
    color: var(--primary);
    font-weight: 600;
}

/* Dynamic simulation results display */
.cost-price-result {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.cost-price-result-total {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    font-weight: 400;
}

.total-summary-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(192, 132, 252, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.total-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.total-summary-row:last-child {
    border-bottom: none;
    padding-top: 15px;
    margin-top: 5px;
}

.total-summary-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.total-summary-val {
    font-weight: 600;
    color: #fff;
}

.total-summary-big {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Admin Dashboard User Table style */
.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.1);
}

.table-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Simulation view table results */
.alloc-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
