/**
 * msmedia.pay - Style CSS personnalisé inspiré de shadcn/ui
 * Version: 1.0.0
 */

/* ========================================
   CSS Variables (Thème shadcn/ui)
   ======================================== */
:root {
    /* Couleurs de base (Light Theme - Slate/Indigo) */
    --background: 210 40% 98%;      /* Slate 50 */
    --foreground: 222.2 84% 4.9%;   /* Slate 950 */
    
    --card: 0 0% 100%;              /* White */
    --card-foreground: 222.2 84% 4.9%;
    
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    
    /* Primary: Violet/Indigo Vibrante */
    --primary: 262 83% 58%;         /* Violet 600 */
    --primary-foreground: 210 40% 98%;
    
    --secondary: 210 40% 96.1%;     /* Slate 100 */
    --secondary-foreground: 222.2 47.4% 11.2%;
    
    --muted: 210 40% 96.1%;         /* Slate 100 */
    --muted-foreground: 215.4 16.3% 46.9%; /* Slate 500 */
    
    --accent: 210 40% 93%;          /* Slate 200 */
    --accent-foreground: 222.2 47.4% 11.2%;
    
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    
    --border: 214.3 31.8% 91.4%;    /* Slate 200 */
    --input: 214.3 31.8% 91.4%;
    --ring: 262 83% 58%;            /* Primary Ring */
    
    --radius: 0.75rem;              /* Plus arrondi pour un look moderne */
    
    /* Couleurs sémantiques */
    --success: 142 71% 45%;         /* Emerald 500 */
    --success-foreground: 210 40% 98%;
    --warning: 45 93% 47%;          /* Amber 500 */
    --warning-foreground: 210 40% 98%;
    --info: 199 89% 48%;            /* Sky 500 */
    --info-foreground: 210 40% 98%;
}

/* Thème sombre (Dark Theme - Deep Slate) */
.dark {
    --background: 222 47% 11%;      /* Slate 950 */
    --foreground: 210 40% 98%;      /* Slate 50 */
    
    --card: 217 33% 17%;            /* Slate 800 */
    --card-foreground: 210 40% 98%;
    
    --popover: 217 33% 17%;
    --popover-foreground: 210 40% 98%;
    
    --primary: 263 70% 50%;         /* Violet 500 plus doux sur fond sombre */
    --primary-foreground: 210 40% 98%;
    
    --secondary: 215 28% 17%;       /* Slate 800 */
    --secondary-foreground: 210 40% 98%;
    
    --muted: 215 28% 17%;
    --muted-foreground: 215 20.2% 65.1%; /* Slate 400 */
    
    --accent: 215 28% 25%;          /* Slate 700 */
    --accent-foreground: 210 40% 98%;
    
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    
    --border: 215 28% 25%;          /* Slate 700 */
    --input: 215 28% 25%;
    --ring: 263 70% 50%;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    border-color: hsl(var(--border));
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Card Component
   ======================================== */
.card {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px hsl(var(--border)), 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.2s ease;
}

.dark .card {
    box-shadow: 0 0 0 1px hsl(var(--border)), 0 4px 6px -1px rgb(0 0 0 / 0.2);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.025em;
    margin: 0;
}

.card-description {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin-top: 0.375rem;
}

.card-content {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
}

/* ========================================
   Button Component
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    border: none;
    cursor: pointer;
}

.btn:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(262 80% 50%));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 4px 6px -1px id(hsl(var(--primary) / 0.3));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, hsl(262 80% 50%), hsl(var(--primary)));
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px hsl(var(--primary) / 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--input));
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-success {
    background-color: hsl(var(--success));
    color: hsl(var(--success-foreground));
}

.btn-success:hover {
    background-color: hsl(var(--success) / 0.9);
}

.btn-sm {
    height: 2.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    height: 2.75rem;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
}

.btn-icon {
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
}

/* ========================================
   Input Component
   ======================================== */
.form-control,
.form-select {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    transition: all 0.2s ease;
}

.form-control::placeholder {
    color: hsl(var(--muted-foreground));
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-control:disabled,
.form-select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
    display: block;
}

textarea.form-control {
    min-height: 5rem;
    resize: vertical;
}

/* ========================================
   Table Component
   ======================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    height: 3rem;
    padding: 0.5rem 1rem;
    text-align: left;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background-color: hsl(var(--muted));
    border-bottom: 1px solid hsl(var(--border));
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: hsl(var(--muted) / 0.5);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   Badge Component
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.badge-default {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.badge-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.badge-success {
    background-color: hsl(var(--success));
    color: hsl(var(--success-foreground));
}

.badge-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.badge-warning {
    background-color: hsl(var(--warning));
    color: hsl(var(--warning-foreground));
}

.badge-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

/* ========================================
   Alert Component
   ======================================== */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.875rem;
    color: inherit;
    opacity: 0.9;
}

.alert-default {
    background-color: hsl(var(--background));
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

.alert-success {
    background-color: hsl(var(--success) / 0.1);
    border-color: hsl(var(--success) / 0.3);
    color: hsl(var(--success));
}

.alert-destructive {
    background-color: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
}

.alert-warning {
    background-color: hsl(var(--warning) / 0.1);
    border-color: hsl(var(--warning) / 0.3);
    color: hsl(var(--warning));
}

.alert-info {
    background-color: hsl(var(--info) / 0.1);
    border-color: hsl(var(--info) / 0.3);
    color: hsl(var(--info));
}

/* ========================================
   Modal Component (Custom)
   ======================================== */
.custom-modal-wrapper {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgb(0 0 0 / 0.8);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.custom-modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.custom-modal-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 51;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.custom-modal-backdrop.show + .custom-modal-dialog,
.custom-modal-dialog.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.custom-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.custom-modal-close {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.custom-modal-close:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--muted));
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 17rem;
    background-color: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    z-index: 40;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px -1px rgb(0 0 0 / 0.02);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 0.25rem;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0.75rem;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu-link:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--foreground));
}

.sidebar-menu-link.active {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    font-weight: 600;
}

.sidebar-menu-link svg,
.sidebar-menu-link i {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid hsl(var(--border));
}

/* Main content with sidebar */
.main-content {
    margin-left: 17rem;
    min-height: 100vh;
}

.main-header {
    position: sticky;
    top: 0;
    background-color: hsl(var(--background) / 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.5rem;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.main-header-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.main-body {
    padding: 1.5rem;
}

/* ========================================
   Login Page Styles
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, hsl(var(--primary) / 0.05) 0%, hsl(var(--secondary)) 100%);
}

.auth-card {
    width: 100%;
    max-width: 24rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo img {
    max-width: 12rem;
    height: auto;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
    color: hsl(var(--foreground));
}

.otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.otp-input {
    width: 3rem;
    height: 3rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    transition: all 0.2s ease;
}

.otp-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ========================================
   Dashboard Stats Cards
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stat-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    margin: 0;
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    transition: transform 0.2s ease;
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.1);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 0;
    letter-spacing: -0.02em;
}

.stat-card-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.stat-card-change.positive {
    color: hsl(var(--success));
}

.stat-card-change.negative {
    color: hsl(var(--destructive));
}

/* ========================================
   Utilities
   ======================================== */
.text-muted {
    color: hsl(var(--muted-foreground));
}

.text-success {
    color: hsl(var(--success));
}

.text-destructive {
    color: hsl(var(--destructive));
}

.text-warning {
    color: hsl(var(--warning));
}

.border-t {
    border-top: 1px solid hsl(var(--border));
}

.border-b {
    border-bottom: 1px solid hsl(var(--border));
}

.rounded {
    border-radius: var(--radius);
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.shadow {
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Animation */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-dialog {
        max-width: calc(100% - 2rem);
        margin: 1rem;
    }
}

/* ========================================
   Loading States
   ======================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        hsl(var(--muted)) 25%,
        hsl(var(--muted) / 0.5) 50%,
        hsl(var(--muted)) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar,
    .main-header,
    .btn,
    .modal-backdrop,
    .modal-dialog {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}
