/* QRCode Generator - Custom Styles */

:root {
    --primary-color: #263C86;
    --secondary-color: #FFFFFF;
    --primary-gradient: linear-gradient(135deg, #263C86 0%, #1a2a5e 100%);
    --bg-pink: #e83e8c;
    --accent-light: #4a5fa8;
}

/* Global Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(38, 60, 134, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loader-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: white;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loader-text {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-loading .btn-text {
    visibility: hidden;
}

/* Inline Loader for cards/sections */
.inline-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.inline-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Global Styles */
body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

main {
    flex: 1;
}

/* Navbar */
.navbar {
    background: var(--primary-gradient) !important;
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

/* Hero Section */
.hero-section {
    padding: 2rem 0;
}

.hero-section h1 {
    color: var(--primary-color);
}

/* Cards */
.card {
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    border-radius: 1rem 1rem 0 0 !important;
}

.card-header.bg-primary {
    background: var(--primary-gradient) !important;
}

/* Form Styles */
.agent-row {
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(38, 60, 134, 0.25);
}

/* Photo upload styles */
.photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.photo-upload-container {
    position: relative;
    display: inline-block;
}

.photo-upload-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px dashed var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.photo-upload-btn:hover {
    background-color: #e9ecef;
    border-color: var(--accent-light);
}

.photo-upload-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.photo-input {
    display: none;
}

/* Excel import section */
.excel-import-section {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.excel-drop-zone {
    border: 2px dashed var(--primary-color);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.excel-drop-zone:hover,
.excel-drop-zone.dragover {
    background-color: rgba(38, 60, 134, 0.05);
    border-color: var(--accent-light);
}

.excel-drop-zone i {
    font-size: 3rem;
    color: var(--primary-color);
}

/* Table Styles */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.qr-thumbnail {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.qr-thumbnail:hover {
    transform: scale(1.5);
    z-index: 10;
    position: relative;
}

.agent-photo-thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

/* Badge Styles */
.bg-pink {
    background-color: var(--bg-pink) !important;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Filigrane "Ancien Agent" pour agents désactivés - contenu dans le cadre */
.ancien-agent-filigrane {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ancien-agent-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: rgb(252, 0, 0);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transform: rotate(-35deg);
    white-space: nowrap;
    text-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
    user-select: none;
    background-color: rgba(255, 255, 255, 0.65);
    padding: 0rem 0rem;
    border-radius: 8px;
}

/* Profile Page Styles */
.profile-card {
    border-radius: 1.5rem;
}

.profile-header {
    background: var(--primary-gradient);
    position: relative;
}

.profile-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 30px;
    background: white;
    border-radius: 30px 30px 0 0;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qr-container {
    background: linear-gradient(145deg, #f0f0f0, #ffffff);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.qr-code-large {
    max-width: 200px;
    border-radius: 12px;
}

.info-item {
    transition: all 0.2s ease;
}

.info-item:hover {
    transform: translateX(5px);
    background-color: #e9ecef !important;
}

/* Error Pages */
.error-container {
    padding: 3rem;
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1a2a5e 0%, #0f1a3d 100%);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    border-color: transparent;
}

/* Text colors */
.text-primary {
    color: var(--primary-color) !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-header {
        padding: 2rem 1rem !important;
    }
    
    .qr-code-large {
        max-width: 150px;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .agent-row .row {
        gap: 0.5rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Nav tabs for import methods */
.nav-tabs .nav-link {
    color: var(--primary-color);
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: transparent;
}

/* User Avatar in Navbar */
.user-avatar-xs {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
}
