/**
 * FormaLearning QR Generator - Charte graphique
 * Couleurs: Violet #210551, Orange #FF831D, Turquoise #00CCB0
 * Typo: Archivo
 */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&display=swap');

:root {
    /* Couleurs primaires */
    --violet: #210551;
    --violet-dark: #1a0440;
    --violet-light: #C4B3E8;
    --orange: #FF831D;
    --orange-light: #ff9a42;
    --turquoise: #00CCB0;
    --turquoise-dark: #00b89f;
    
    /* Couleurs secondaires */
    --cream: #FDFAEF;
    --red: #EF3A4D;
    --lavender: #C4B3E8;
    
    /* Neutres */
    --gray-light: #F5F3F7;
    --gray-medium: #E8E4F0;
    --gray-text: #6B5B7A;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(33, 5, 81, 0.06);
    --shadow: 0 4px 16px rgba(33, 5, 81, 0.08);
    --shadow-lg: 0 8px 32px rgba(33, 5, 81, 0.12);
    --shadow-orange: 0 4px 16px rgba(255, 131, 29, 0.4);
    --shadow-turquoise: 0 4px 16px rgba(0, 204, 176, 0.3);
    
    /* Radius */
    --radius: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--cream);
    color: var(--violet);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    background: linear-gradient(135deg, var(--violet) 0%, var(--violet-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: var(--orange);
    border-radius: 50%;
    opacity: 0.1;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: var(--turquoise);
    border-radius: 50%;
    opacity: 0.1;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header .logo {
    margin-bottom: 20px;
}

.login-header .logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.login-header .logo-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--violet) 0%, var(--violet-dark) 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 700;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--violet);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-header .subtitle {
    color: var(--gray-text);
    font-size: 15px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--gray-medium);
    border-radius: var(--radius);
    transition: all 0.2s;
    background: white;
}

.login-form input:focus {
    outline: none;
    border-color: var(--turquoise);
    box-shadow: 0 0 0 4px rgba(0, 204, 176, 0.15);
}

.login-form input:disabled {
    background: var(--gray-light);
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--gray-text);
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, var(--violet) 0%, var(--violet-dark) 100%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(33, 5, 81, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-logo-placeholder {
    font-size: 20px;
    font-weight: 700;
    color: var(--violet);
}

.header-title {
    display: flex;
    flex-direction: column;
}

.header-title h1 {
    color: white;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1.2;
}

.header-title p {
    color: var(--lavender);
    font-size: 13px;
    margin: 2px 0 0 0;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    padding: 32px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== CARDS ==================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 32px;
    border: 1px solid rgba(33, 5, 81, 0.06);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--violet);
    margin-bottom: 24px;
}

.icon-box {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--turquoise) 0%, var(--turquoise-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-box svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.icon-box.purple {
    background: linear-gradient(135deg, var(--lavender) 0%, #b3a0db 100%);
}

.icon-box.purple svg {
    fill: var(--violet);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* ==================== FORMS ==================== */
.form-row, .create-form {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group.flex-2 {
    flex: 2;
    min-width: 300px;
}

.form-group.form-actions {
    flex: 0 0 auto;
    min-width: auto;
    display: flex;
    align-items: flex-end;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--violet);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid var(--gray-medium);
    border-radius: var(--radius);
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--turquoise);
    box-shadow: 0 0 0 4px rgba(0, 204, 176, 0.15);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
}

.btn-block {
    width: 100%;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 131, 29, 0.5);
}

.btn-primary:disabled {
    background: var(--gray-medium);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: var(--gray-text);
}

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

.btn-secondary:hover {
    background: var(--violet-dark);
}

.btn-outline {
    background: transparent;
    color: var(--orange);
    border: 2px solid var(--orange);
}

.btn-outline:hover {
    background: rgba(255, 131, 29, 0.1);
}

.btn-download {
    background: var(--violet);
    color: white;
    border: none;
}

.btn-download:hover {
    background: var(--violet-dark);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 2px solid var(--red);
}

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

.header .btn-outline {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 20px;
}

.header .btn-outline:hover {
    background: rgba(255,255,255,0.25);
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: linear-gradient(135deg, rgba(0, 204, 176, 0.15) 0%, rgba(0, 204, 176, 0.08) 100%);
    color: var(--turquoise-dark);
    border: 1px solid rgba(0, 204, 176, 0.3);
}

.alert-success::before {
    content: '✓';
    width: 24px;
    height: 24px;
    background: var(--turquoise);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.alert-error {
    background: linear-gradient(135deg, rgba(239, 58, 77, 0.15) 0%, rgba(239, 58, 77, 0.08) 100%);
    color: var(--red);
    border: 1px solid rgba(239, 58, 77, 0.3);
}

.alert-error::before {
    content: '!';
    width: 24px;
    height: 24px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ==================== BADGE ==================== */
.badge {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    background: var(--violet);
    color: white;
    border-radius: 20px;
}

/* ==================== INFO BOX ==================== */
.info-box {
    background: linear-gradient(135deg, rgba(0, 204, 176, 0.12) 0%, rgba(0, 204, 176, 0.06) 100%);
    border: 1px solid rgba(0, 204, 176, 0.25);
    color: var(--violet);
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 20px;
}

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

.empty-state svg {
    opacity: 0.3;
    color: var(--violet);
}

.empty-state p {
    margin-top: 16px;
    font-size: 16px;
}

/* ==================== QR GRID ==================== */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

.qr-card {
    background: var(--cream);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(33, 5, 81, 0.08);
    transition: all 0.2s;
}

.qr-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.qr-preview {
    background: white;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.qr-preview img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    border: 2px solid var(--gray-medium);
    object-fit: contain;
    background: white;
    flex-shrink: 0;
}

.qr-info {
    flex: 1;
    min-width: 0;
}

.qr-info h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--violet);
    margin-bottom: 10px;
}

.qr-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.meta-item {
    font-size: 13px;
    color: var(--gray-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item.scans {
    color: var(--turquoise);
    font-weight: 600;
}

.qr-url, .qr-redirect {
    margin-bottom: 10px;
}

.qr-url label, .qr-redirect label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.url-display {
    word-break: break-all;
}

.url-display a {
    color: var(--violet);
    text-decoration: none;
    font-size: 13px;
}

.url-display a:hover {
    color: var(--orange);
    text-decoration: underline;
}

.qr-redirect code {
    display: block;
    background: var(--gray-light);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    color: var(--gray-text);
    word-break: break-all;
    font-family: 'Monaco', 'Consolas', monospace;
}

.qr-actions {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid rgba(33, 5, 81, 0.06);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 5, 81, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    padding: 32px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--violet);
}

.modal-close {
    background: var(--gray-light);
    border: none;
    font-size: 24px;
    color: var(--gray-text);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-medium);
    color: var(--violet);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal .btn-outline {
    color: var(--violet);
    border-color: var(--gray-medium);
}

.modal .btn-outline:hover {
    background: var(--gray-light);
    border-color: var(--violet);
}

.text-muted {
    color: var(--gray-text);
    font-size: 14px;
}

/* ==================== FOOTER ==================== */
footer {
    text-align: center;
    padding: 24px;
    color: var(--gray-text);
    font-size: 13px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .form-row, .create-form {
        flex-direction: column;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .form-group.flex-2 {
        min-width: 100%;
    }
    
    .qr-grid {
        grid-template-columns: 1fr;
    }
    
    .qr-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .qr-meta {
        justify-content: center;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .login-box {
        padding: 32px 24px;
    }
    
    .card {
        padding: 24px;
    }
    
    .action-row {
        justify-content: center;
    }
    
    .action-row .btn-danger {
        margin-left: 0;
    }
    
    .section-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .trash-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .trash-item-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== SECTION ACTIONS ==================== */
.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==================== CORBEILLE ==================== */
.trash-section {
    border: 1px solid rgba(239, 58, 77, 0.2);
    background: linear-gradient(135deg, rgba(239, 58, 77, 0.02) 0%, white 100%);
}

.trash-info {
    background: rgba(239, 58, 77, 0.08);
    border: 1px solid rgba(239, 58, 77, 0.15);
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--violet);
    margin-bottom: 20px;
}

.trash-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius);
    gap: 16px;
}

.trash-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trash-item-info strong {
    color: var(--violet);
    font-size: 15px;
}

.trash-meta {
    font-size: 13px;
    color: var(--gray-text);
}

.days-left {
    color: var(--red);
    font-weight: 600;
}

.trash-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

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