/* ============================================================
   TERRA ESPACE CLIENT - Frontend CSS
   ============================================================ */
:root {
    --tc-primary:  #0066CC;
    --tc-green:    #27AE60;
    --tc-orange:   #F39C12;
    --tc-red:      #E74C3C;
    --tc-border:   #e8edf2;
    --tc-bg:       #f0f4f8;
    --tc-text:     #1a1a2e;
    --tc-muted:    #666;
    --tc-radius:   16px;
    --tc-shadow:   0 4px 24px rgba(0,0,0,0.08);
    --tc-shadow-lg:0 12px 48px rgba(0,0,0,0.14);
}

/* ── Wrapper ── */
.tc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 520px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.tc-dashboard { max-width: 900px; }

/* ── Auth Card ── */
.tc-auth-card {
    background: #fff;
    border-radius: var(--tc-radius);
    padding: 40px 36px;
    box-shadow: var(--tc-shadow);
    text-align: center;
}

.tc-auth-icon {
    width: 72px; height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--tc-primary), #0099CC);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(0,102,204,0.3);
}

.tc-auth-title {
    font-size: 26px; font-weight: 800;
    color: var(--tc-text); margin: 0 0 8px;
}

.tc-auth-sub {
    font-size: 14px; color: var(--tc-muted); margin: 0 0 28px;
}

.tc-auth-footer {
    margin: 20px 0 0;
    font-size: 14px; color: var(--tc-muted);
}

/* ── Fields ── */
.tc-field { text-align: left; margin-bottom: 18px; }
.tc-field label { display: block; font-size: 13px; font-weight: 600; color: var(--tc-text); margin-bottom: 7px; }
.tc-field label small { font-weight: 400; color: #999; }
.tc-field .req { color: var(--tc-red); }

.tc-field input, .tc-field select, .tc-field textarea {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--tc-border);
    border-radius: 10px;
    font-size: 14px; color: var(--tc-text);
    background: #fafbfc;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box; font-family: inherit;
}
.tc-field input:focus, .tc-field select:focus {
    outline: none; border-color: var(--tc-primary);
    background: #fff; box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.tc-input-wrap { position: relative; }
.tc-input-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.tc-input-wrap input { padding-left: 38px; padding-right: 38px; }
.tc-pwd-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px;
    color: #999; line-height: 1;
}

.tc-field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tc-field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tc-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tc-muted); cursor: pointer; }
.tc-link { color: var(--tc-primary); text-decoration: none; font-size: 13px; }
.tc-link:hover { text-decoration: underline; }

/* Force de mot de passe */
.tc-pwd-strength { height: 4px; border-radius: 2px; margin-top: 6px; transition: all .3s; }

/* ── Boutons ── */
.tc-btn-primary {
    width: 100%; padding: 14px;
    background: var(--tc-primary);
    color: #fff; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 8px;
    transition: filter .2s, transform .2s;
}
.tc-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.tc-btn-primary:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.tc-btn-green { background: var(--tc-green); }

@keyframes tc-spin { to { transform: rotate(360deg); } }
.tc-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: tc-spin .7s linear infinite;
}

/* ── Messages ── */
.tc-msg {
    padding: 12px 16px; border-radius: 8px;
    font-size: 13px; margin-bottom: 16px; text-align: left;
}
.tc-msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.tc-msg.error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.tc-notice.tc-error { background:#fef2f2;color:#dc2626;padding:16px;border-radius:8px;border:1px solid #fca5a5; }

/* ================================================================
   DASHBOARD
================================================================ */
.tc-dashboard-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 16px;
    margin-bottom: 28px; flex-wrap: wrap;
}
.tc-greeting { font-size: 26px; font-weight: 800; color: var(--tc-text); margin: 0 0 4px; }
.tc-user-email  { font-size: 14px; color: var(--tc-muted); margin: 0; }
.tc-user-company{ font-size: 13px; color: var(--tc-muted); margin: 4px 0 0; }

.tc-logout-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 10px;
    border: 1.5px solid var(--tc-border);
    background: #fff; cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--tc-text);
    transition: all .2s; white-space: nowrap;
}
.tc-logout-btn:hover { border-color: var(--tc-red); color: var(--tc-red); }

/* Stats */
.tc-stats-grid {
    display: grid; grid-template-columns: repeat(3,1fr);
    gap: 16px; margin-bottom: 28px;
}
.tc-stat-card {
    background: #fff; border: 1px solid var(--tc-border);
    border-radius: 14px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--tc-shadow);
}
.tc-stat-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.tc-stat-num   { font-size: 28px; font-weight: 800; color: var(--tc-text); line-height: 1; }
.tc-stat-label { font-size: 12px; color: var(--tc-muted); margin-top: 2px; }

/* Tabs */
.tc-tabs {
    display: flex; gap: 4px; margin-bottom: 0;
    border-bottom: 2px solid var(--tc-border);
}
.tc-tab {
    padding: 12px 20px; border: none; background: none;
    font-size: 14px; font-weight: 600; color: var(--tc-muted);
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .2s;
}
.tc-tab.active { color: var(--tc-primary); border-bottom-color: var(--tc-primary); }
.tc-tab:hover { color: var(--tc-primary); }

.tc-tab-content {
    background: #fff; border: 1px solid var(--tc-border);
    border-top: none; border-radius: 0 0 14px 14px;
    padding: 24px; box-shadow: var(--tc-shadow);
}

/* Empty state */
.tc-empty-state {
    text-align: center; padding: 48px 20px; color: var(--tc-muted);
}
.tc-empty-state p { font-size: 15px; margin: 16px 0 6px; font-weight: 600; color: #aaa; }
.tc-empty-state small { font-size: 13px; color: #bbb; }

/* Orders list */
.tc-orders-list { display: flex; flex-direction: column; gap: 0; }
.tc-order-row {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 14px 0; border-bottom: 1px solid var(--tc-border);
}
.tc-order-row:last-child { border: none; }
.tc-order-ref { min-width: 120px; }
.tc-order-num { font-weight: 700; font-size: 14px; color: var(--tc-text); display: block; }
.tc-order-ref small { font-size: 12px; color: #999; }
.tc-order-service { flex: 1; font-size: 14px; color: var(--tc-text); }
.tc-order-amount { font-size: 14px; font-weight: 700; color: var(--tc-text); }
.tc-order-status {
    display: inline-block; padding: 4px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* Profile */
.tc-profile-form { max-width: 560px; }
.tc-profile-form .tc-field { margin-bottom: 16px; }
.tc-profile-form .tc-btn-primary { max-width: 260px; margin-top: 8px; }

/* ── Responsive ── */
@media(max-width:640px) {
    .tc-wrapper     { padding: 12px; }
    .tc-auth-card   { padding: 28px 20px; }
    .tc-stats-grid  { grid-template-columns: 1fr; gap: 10px; }
    .tc-field-row-2 { grid-template-columns: 1fr; }
    .tc-dashboard-header { flex-direction: column; }
    .tc-tabs { overflow-x: auto; }
    .tc-order-row { gap: 10px; }
}
