/**
 * PRO SMART CHECK - Styles CSS
 * Mobile-first responsive design
 */

/* =============================================
   Variables CSS
   ============================================= */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #fd7e14;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --border-radius: 12px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* =============================================
   Reset & Base
   ============================================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* =============================================
   Splash Screen
   ============================================= */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-content h1 {
    margin-top: 1rem;
    font-weight: 700;
}

.splash-content .spinner-border {
    width: 3rem;
    height: 3rem;
    border-color: white;
    border-right-color: transparent;
}

/* =============================================
   Layout
   ============================================= */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-container {
    flex: 1;
    padding: 1rem;
    padding-bottom: 5rem;
}

/* =============================================
   Navigation Header
   ============================================= */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-custom .navbar-brand {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.navbar-custom .btn-logout {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
}

.navbar-custom .btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Badge notification */
.badge-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
}

/* =============================================
   Cards
   ============================================= */
.card-custom {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-custom .card-header {
    background: var(--light-color);
    border-bottom: 1px solid #e9ecef;
    padding: 1rem;
    font-weight: 600;
}

.card-custom .card-body {
    padding: 1.25rem;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Boutons tactiles (min 48px) */
.btn-touch {
    min-height: 48px;
    min-width: 48px;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:active {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
}

.btn-warning {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-outline-secondary {
    border-width: 2px;
}

/* Bouton scan (grand et circulaire) */
.btn-scan {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.btn-scan i {
    font-size: 2.5rem;
}

/* =============================================
   Forms
   ============================================= */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.input-group-text {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: var(--light-color);
}

/* =============================================
   Scanner Interface
   ============================================= */
.scanner-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 2000;
}

.scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.scanner-header {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.scanner-frame {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame-box {
    width: 280px;
    height: 100px;
    border: 3px solid var(--primary-color);
    border-radius: 8px;
    position: relative;
}

.scanner-frame-box::before,
.scanner-frame-box::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid var(--success-color);
}

.scanner-frame-box::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: 8px 0 0 0;
}

.scanner-frame-box::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 8px 0;
}

.scanner-footer {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1.5rem;
    pointer-events: auto;
}

.scanner-result {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.scanner-result-serial {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--dark-color);
    letter-spacing: 2px;
}

.scanner-counter {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
}

/* =============================================
   Status Icons (Opérateur)
   ============================================= */
.status-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.status-icon i {
    font-size: 2.5rem;
}

.status-icon.success {
    background: rgba(25, 135, 84, 0.15);
    color: var(--success-color);
}

.status-icon.warning {
    background: rgba(253, 126, 20, 0.15);
    color: var(--warning-color);
}

.status-icon.danger {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
}

/* =============================================
   Tables
   ============================================= */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background: var(--light-color);
}

.table th {
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

/* =============================================
   Modals
   ============================================= */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

/* =============================================
   Login Page
   ============================================= */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary-color);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
    color: var(--dark-color);
}

/* =============================================
   Admin Dashboard
   ============================================= */
.stats-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stats-card .stats-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.stats-card.danger .stats-number {
    color: var(--danger-color);
}

/* =============================================
   User List
   ============================================= */
.user-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.user-item:last-child {
    border-bottom: none;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-email {
    font-size: 0.85rem;
    color: #6c757d;
}

.user-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.user-role.utilisateur {
    background: rgba(13, 110, 253, 0.15);
    color: var(--primary-color);
}

.user-role.operateur {
    background: rgba(25, 135, 84, 0.15);
    color: var(--success-color);
}

/* =============================================
   Alerts (Signalements)
   ============================================= */
.alert-item {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--danger-color);
    box-shadow: var(--shadow);
}

.alert-item .serial {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.1rem;
}

.alert-item .meta {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* =============================================
   Utilities
   ============================================= */
.text-mono {
    font-family: 'Courier New', monospace;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

/* =============================================
   Animations
   ============================================= */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* =============================================
   Responsive
   ============================================= */
@media (min-width: 576px) {
    .page-container {
        padding: 1.5rem;
        max-width: 540px;
        margin: 0 auto;
    }
}

@media (min-width: 768px) {
    .page-container {
        max-width: 720px;
    }
    
    .scanner-frame-box {
        width: 350px;
        height: 120px;
    }
}

@media (min-width: 992px) {
    .page-container {
        max-width: 960px;
    }
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    .navbar-custom,
    .btn,
    .scanner-container {
        display: none !important;
    }
}
