/* CCN Technology — Feuille de style principale */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:   #2ECC8C;
    --orange:  #F5A623;
    --dark:    #1a1a2e;
    --sidebar: #16213e;
    --blue:    #0f3460;
    --bg:      #f0f2f5;
    --white:   #ffffff;
    --text:    #333;
    --muted:   #888;
    --radius:  12px;
    --shadow:  0 2px 16px rgba(0,0,0,.08);
}

body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); }
.app-wrapper   { display: flex; min-height: 100vh; }
.sidebar       { width: 220px; background: var(--sidebar); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.main-content  { margin-left: 220px; flex: 1; padding: 32px 28px; min-height: 100vh; }

.sidebar-logo  { padding: 28px 24px 20px; font-size: 20px; font-weight: 900; color: var(--green); letter-spacing: -0.5px; line-height: 1.2; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-nav   { flex: 1; padding: 16px 0; }
.sidebar-nav a, .sidebar-footer a { display: flex; align-items: center; gap: 10px; padding: 12px 22px; color: rgba(255,255,255,.65); text-decoration: none; font-size: 14px; font-weight: 500; transition: all .2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover, .sidebar-footer a:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav a.active, .sidebar-footer a.active { color: var(--green); background: rgba(46,204,140,.1); border-left-color: var(--green); }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 16px 0; border-top: 1px solid rgba(255,255,255,.07); }

.page-header   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 26px; font-weight: 800; color: var(--dark); }
.header-right  { display: flex; align-items: center; gap: 12px; }
.auto-badge    { background: rgba(46,204,140,.15); color: var(--green); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; }

.btn           { padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .2s, transform .1s; }
.btn:hover     { opacity: .88; transform: translateY(-1px); }
.btn:active    { transform: translateY(0); }
.btn-teal      { background: var(--green); color: #fff; }
.btn-orange    { background: var(--orange); color: #fff; }
.btn-blue      { background: var(--blue); color: #fff; }
.btn-red       { background: #e74c3c; color: #fff; padding: 8px 14px; border-radius: 7px; }
.btn-sm        { padding: 6px 14px; font-size: 12px; }

.stats-grid    { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card     { background: var(--white); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); }
.stat-card-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card-value { font-size: 36px; font-weight: 800; color: var(--dark); margin: 8px 0 10px; }
.stat-card-bar { height: 4px; background: var(--orange); border-radius: 2px; width: 40%; }

.dashboard-lower   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.dash-table-card   { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dash-stats-card   { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.dash-stats-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--dark); }
.dash-stats-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.dash-bottom-banner { background: linear-gradient(135deg, var(--dark), var(--blue)); color: #fff; border-radius: var(--radius); padding: 24px 28px; }
.dash-bottom-banner h3 { font-size: 18px; margin-bottom: 6px; }
.dash-bottom-banner p  { font-size: 13px; opacity: .75; }

.clients-form-card  { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.clients-form-row   { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.clients-form-row input { flex: 1; min-width: 140px; padding: 10px 14px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.clients-form-row input:focus { border-color: var(--green); }
.csv-info { font-size: 12px; color: var(--muted); flex: 1; min-width: 200px; }
#csvFileInput { display: none; }

.clients-table      { border-collapse: collapse; }
.clients-table th   { background: var(--orange); color: #fff; padding: 14px 16px; text-align: left; font-weight: 700; font-size: 13px; }
.clients-table td   { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr:hover td { background: #fafafa; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-active    { background: rgba(46,204,140,.15); color: #1a9e6e; }
.badge-soon      { background: rgba(245,166,35,.15); color: #c47d00; }
.badge-expired   { background: rgba(231,76,60,.15);  color: #c0392b; }
.badge-suspended { background: rgba(136,136,136,.15);color: #555; }

.stats-chart-card  { background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.stats-chart-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--dark); }

.automation-card       { background: var(--white); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.automation-card-info h2 { font-size: 18px; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.automation-card-info p  { color: var(--muted); font-size: 14px; }
.automation-card-toggle  { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.automation-btns         { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.toggle-switch           { position: relative; display: inline-block; width: 52px; height: 28px; }
.toggle-switch input     { opacity: 0; width: 0; height: 0; }
.toggle-slider           { position: absolute; inset: 0; background: #ccc; border-radius: 28px; cursor: pointer; transition: .3s; }
.toggle-slider::before   { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
input:checked + .toggle-slider            { background: var(--green); }
input:checked + .toggle-slider::before   { transform: translateX(24px); }

.history-card      { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.history-card h3   { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--dark); }
.history-list      { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.history-item      { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 8px; background: #fafafa; border: 1px solid #f0f0f0; font-size: 13px; }
.history-item.ok   { border-left: 3px solid var(--green); }
.history-item.fail { border-left: 3px solid #e74c3c; }
.history-meta      { color: var(--muted); font-size: 12px; margin-top: 2px; }

.smtp-card         { background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); max-width: 620px; }
.smtp-card h2      { font-size: 18px; font-weight: 700; margin-bottom: 22px; color: var(--dark); }
.form-group        { margin-bottom: 16px; }
.form-group label  { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-group input  { width: 100%; padding: 11px 14px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.form-group input:focus { border-color: var(--green); }

#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast           { padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.18); animation: slideIn .3s ease; max-width: 360px; line-height: 1.4; }
.toast.success   { background: var(--green); }
.toast.error     { background: #e74c3c; }
.toast.info      { background: var(--blue); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 768px) {
    .sidebar       { width: 0; overflow: hidden; }
    .main-content  { margin-left: 0; padding: 16px; }
    .dashboard-lower { grid-template-columns: 1fr; }
    .stats-grid    { grid-template-columns: 1fr 1fr; }
}
