/* 
 * CopyBadge Portal - Styles
 * Design moderne et professionnel
 */

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary: #0ea5e9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --gray-lighter: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #0ea5e9 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Auth Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -1px;
}

.auth-logo .subtitle {
    color: var(--gray);
    font-size: 14px;
    margin-top: 5px;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
    text-align: center;
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--gray);
}

.form-control.error {
    border-color: var(--danger);
}

.form-hint {
    font-size: 12px;
    color: var(--gray);
    margin-top: 6px;
}

.form-error {
    font-size: 13px;
    color: var(--danger);
    margin-top: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Links */
.auth-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.auth-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Code Input */
.code-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 30px 0;
}

.code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    transition: var(--transition);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Steps */
.steps-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.steps-container::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    height: 2px;
    background: var(--gray-light);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-light);
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--primary);
    color: var(--white);
}

.step.completed .step-number {
    background: var(--success);
    color: var(--white);
}

.step-label {
    font-size: 12px;
    color: var(--gray);
    text-align: center;
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    background: var(--gray-lighter);
}

.dashboard-header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.dashboard-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dashboard-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-user-name {
    font-weight: 500;
    color: var(--dark);
}

.dashboard-content {
    padding: 40px 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--white);
    padding: 8px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 14px 20px;
    text-align: center;
    border-radius: 8px;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: transparent;
}

.tab:hover {
    background: var(--gray-lighter);
}

.tab.active {
    background: var(--primary);
    color: var(--white);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 16px;
}

/* Device List */
.device-list {
    display: grid;
    gap: 16px;
}

.device-item {
    background: var(--gray-lighter);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.device-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.device-info p {
    font-size: 13px;
    color: var(--gray);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.device-status.online {
    color: var(--success);
}

.device-status.offline {
    color: var(--gray);
}

.device-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        padding: 30px 24px;
    }
    
    .code-input {
        width: 45px;
        height: 55px;
        font-size: 20px;
    }
    
    .steps-container::before {
        left: 30px;
        right: 30px;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .tabs {
        flex-direction: column;
    }
}

/* Écrans mobiles étroits (Samsung Fold, petits smartphones) */
@media (max-width: 400px) {
    body {
        font-size: 14px;
    }
    
    .auth-container {
        padding: 12px 8px;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .auth-card {
        padding: 20px 14px;
        max-width: 100%;
        border-radius: 8px;
    }
    
    .auth-logo h1 {
        font-size: 24px;
    }
    
    .auth-logo .subtitle {
        font-size: 12px;
    }
    
    .auth-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-control {
        padding: 12px;
        font-size: 16px; /* Évite le zoom automatique sur iOS */
        border-radius: 6px;
    }
    
    .form-hint {
        font-size: 11px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .steps-container {
        margin-bottom: 24px;
    }
    
    .steps-container::before {
        left: 15px;
        right: 15px;
        top: 14px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .step-label {
        font-size: 9px;
    }
    
    .alert {
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .code-input-container {
        gap: 6px;
        margin: 20px 0;
    }
    
    .code-input {
        width: 38px;
        height: 48px;
        font-size: 18px;
        border-radius: 6px;
    }
    
    .divider {
        margin: 16px 0;
        font-size: 12px;
    }
    
    .modal {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
}

/* Éviter le scroll horizontal */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Timer */
.timer {
    text-align: center;
    font-size: 14px;
    color: var(--gray);
    margin-top: 20px;
}

.timer strong {
    color: var(--primary);
    font-weight: 600;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--gray);
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-light);
}
