/* ============================================================
   DIGITAL VISITING CARD — Style System
   Bootstrap 5 + Dark Mode Custom
   ============================================================ */

/* -- Variables CSS */
:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', var(--font-main);

    --primary: #6C63FF;
    --primary-dark: #4F46E5;
    --primary-glow: rgba(108, 99, 255, 0.25);
    --secondary: #FF6584;

    --bg: #0F0F1A;
    --bg-card: #16162A;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(108, 99, 255, 0.4);

    --text-primary: #F0F0FF;
    --text-secondary: #9898B8;
    --text-muted: #eeeef1;

    --success: #43E97B;
    --error: #FF4B6E;
    --warning: #FFB347;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.3);

    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-muted { color: var(--text-muted) !important; }

/* -- Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); background: var(--bg); color: var(--text-primary); min-height: 100vh; -webkit-font-smoothing: antialiased; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* -- Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(255,101,132,0.1) 0%, transparent 60%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.login-box__logo h1 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box__logo p { color: var(--text-secondary); font-size: 0.88rem; margin-top: 6px; }

/* -- Admin Layout */
.admin-body {
    background: var(--bg);
    color: var(--text-primary);
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.admin-topbar__logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-topbar__logo i { -webkit-text-fill-color: unset; color: var(--primary); }
.admin-topbar__actions { display: flex; align-items: center; gap: 12px; }

.admin-content {
    flex: 1;
    padding: 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* -- Buttons */
.btn-ghost {
    color: var(--text-secondary);
    padding: 8px 12px;
    border: none;
    background: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); border-radius: var(--radius-sm); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px var(--primary-glow);
    font-weight: 600;
    transition: all var(--transition);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(108,99,255,0.45); transform: translateY(-1px); color: #fff; }

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-weight: 600;
    transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); }

.btn-danger {
    background: rgba(255, 75, 110, 0.15);
    color: var(--error);
    border: 1px solid rgba(255, 75, 110, 0.3);
    font-weight: 600;
    transition: all var(--transition);
}
.btn-danger:hover { background: rgba(255, 75, 110, 0.25); color: var(--error); }

/* -- Form Inputs */
.form-control, .input-group-text {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all var(--transition);
}
.form-control:focus, .input-group-text {
    background: var(--bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    color: var(--text-primary);
}
.input-group-text { border-right: none; }
.form-control::placeholder { color: var(--text-muted); }
.form-label { color: var(--text-secondary); font-size: 0.85rem; }

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
}

.form-section__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* -- Page Header */
.page-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 60%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* -- Card Grid (Dashboard) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition);
}

.dash-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.dash-card:hover::before { opacity: 1; }

.dash-card__avatar {
    width: 54px; height: 54px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.dash-card__url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.dash-card__url span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge-template {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary);
    border: 1px solid rgba(108, 99, 255, 0.25);
}

/* -- Photo/Logo Preview */
.photo-preview, .logo-preview {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    overflow: hidden;
}

.logo-preview { border-radius: var(--radius-md); }

.photo-preview img, .logo-preview img {
    width: 100%; height: 100%; object-fit: cover;
}

.media-preview {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    overflow: visible;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
}

.media-preview:hover { border-color: var(--border-hover); }
.media-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--radius-md) - 2px); }

/* -- Templates Grid */
.templates-grid { display: flex; gap: 12px; flex-wrap: wrap; }

.template-option {
    flex: 1;
    min-width: 90px;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.template-option:hover { border-color: var(--border-hover); color: var(--text-primary); }
.template-option.active { border-color: var(--primary); background: rgba(108, 99, 255, 0.1); color: var(--primary); }

.template-preview {
    width: 48px; height: 36px;
    border-radius: 6px;
    overflow: hidden;
}

/* -- Alerts */
.alert { border-radius: var(--radius-md); font-weight: 500; }
.alert-success { background: rgba(67,233,123,0.1); color: var(--success); border: 1px solid rgba(67,233,123,0.2); }
.alert-danger { background: rgba(255,75,110,0.1); color: var(--error); border: 1px solid rgba(255,75,110,0.2); }

/* -- Empty State */
.empty-state h2 { font-family: var(--font-display); font-weight: 700; }

/* -- Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.btn-close { filter: invert(1); }

/* -- Color picker */
.form-control-color {
    width: 48px; height: 48px;
    padding: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ============================================================
   PUBLIC CARD TEMPLATES
   ============================================================ */

.card-public-body {
    background: #0a0a14;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card-page { width: 100%; max-width: 440px; margin: 0 auto; }

.card-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.card-hero {
    padding: 40px 24px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.card-avatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.2);
    position: relative;
    z-index: 1;
}

.card-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    color: #fff;
}

.card-logo-wrap {
    display: flex;
    justify-content: center;
    margin-top: -30px;
    position: relative;
    z-index: 2;
}

.card-logo {
    width: 60px; height: 60px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.card-body { padding: 24px; text-align: center; }

.card-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.card-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.card-dept { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 4px; }
.card-company { color: var(--text-secondary); font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.card-company .dot { width: 6px; height: 6px; border-radius: 50%; }
.card-bio { color: var(--text-secondary); font-size: 0.85rem; margin-top: 12px; line-height: 1.6; }

.card-divider { height: 1px; background: var(--border); margin: 16px 0; }

.card-section { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.card-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all var(--transition);
}
.card-contact-item:hover { border-color: var(--border-hover); background: var(--bg-glass); }
.card-contact-item i { font-size: 1rem; color: var(--primary); min-width: 20px; text-align: center; }

.card-contact-whatsapp i { color: #25D366; }

.card-address {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.card-address i { color: var(--primary); }

/* -- Social Links */
.card-socials {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card-social-link {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.card-social-link:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

/* -- Gallery */
.card-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.card-gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.card-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition); }
.card-gallery-item:hover img { transform: scale(1.05); }

.card-gallery-video {
    grid-column: 1 / -1;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}
.card-gallery-video iframe { width: 100%; height: 100%; }

/* -- Actions */
.card-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    border: none;
}
.btn-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-card-primary { color: #fff; }
.btn-card-whatsapp { background: #25D366; color: #fff; }

.card-share-secondary {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}
.card-share-secondary a { color: var(--text-muted); font-size: 0.85rem; }
.card-share-secondary a:hover { color: var(--primary); }

/* -- Corporate Template */
.card-wrap--corporate { display: flex; flex-direction: row; }
.card-corporate-sidebar {
    width: 140px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.card-corporate-sidebar .card-avatar { width: 80px; height: 80px; border: none; }
.card-corporate-socials { display: flex; flex-direction: column; gap: 10px; }
.card-corporate-socials a { color: rgba(255,255,255,0.7); font-size: 1.1rem; }
.card-corporate-socials a:hover { color: #fff; }
.card-corporate-main { flex: 1; padding: 24px; }

/* -- Premium Template */
.card-wrap--premium { background: #0d0d1a; }
.card-premium-hero { padding: 40px 24px 20px; position: relative; display: flex; flex-direction: column; align-items: center; }
.card-premium-hero__line { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.card-body--premium { background: transparent; }

/* -- Dark Template */
.card-wrap--dark { background: #121212; border-color: #2a2a2a; }
.card-dark-header { padding: 30px 24px 20px; display: flex; justify-content: center; }
.card-dark-header .card-avatar { border-color: #333; }

/* -- Minimal Template */
.card-wrap--minimal { background: #fafafa; border-color: #e0e0e0; }
.card-body--minimal { color: #333; }
.card-name--minimal { color: #111; }
.card-section--minimal .card-contact-item { background: #f5f5f5; border-color: #e0e0e0; color: #333; }
.card-section--minimal .card-contact-item i { color: #555; }

/* -- Responsive */
@media (max-width: 768px) {
    .admin-content { padding: 20px 16px; }
    .card-grid { grid-template-columns: 1fr; }
    .card-wrap--corporate { flex-direction: column; }
    .card-corporate-sidebar { width: 100%; flex-direction: row; justify-content: center; padding: 16px; }
    .card-corporate-socials { flex-direction: row; }
}

@media (max-width: 480px) {
    .templates-grid { flex-direction: column; }
    .card-hero { padding: 24px 16px 20px; }
    .card-body { padding: 16px; }
}

/* -- QR Icon Preview (Settings) */
.qr-icon-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.qr-icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qr-icon-preview__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.qr-icon-preview__empty i {
    font-size: 2.5rem;
    opacity: 0.4;
}

.qr-icon-preview__empty small {
    font-size: 0.72rem;
}

/* -- QR Demo Card (Settings preview) */
.qr-preview-demo {
    flex-shrink: 0;
}

.qr-demo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-demo-card__inner {
    width: 120px;
    height: 120px;
    background: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    /* QR code pattern simulation */
    background-image:
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
    opacity: 0.15;
}

.qr-demo-card__icon {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    opacity: 1;
}

.qr-demo-card__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.qr-demo-card__empty {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: var(--text-muted);
    opacity: 1;
}

.qr-demo-card__empty i {
    font-size: 0.9rem;
}

/* -- Jauge force mot de passe (thème sombre, anti rectangle blanc) */
.login-box .progress,
.login-page .progress {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
#passwordStrengthBar {
    background: transparent;
    transition: width 0.25s ease, background-color 0.25s ease;
}
.login-box .form-text,
.login-page .form-text {
    color: var(--text-secondary);
}
