/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

/* Pages */
.page {
    min-height: 100vh;
}

/* Page de connexion */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.login-container .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 32px;
}

/* Header */
.header {
    background: #fff;
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 20px;
    color: #1a1a1a;
}

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

.header-right span {
    color: #666;
    font-size: 14px;
}

/* Contenu principal */
.main-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Barre d'actions */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.actions-bar h2 {
    font-size: 24px;
    color: #1a1a1a;
}

/* Grille des visites */
.tours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Carte de visite */
.tour-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tour-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tour-card-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.tour-card-header h3 {
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.tour-card-header .model-id {
    font-size: 12px;
    color: #888;
    font-family: monospace;
}

.tour-card-body {
    padding: 20px;
}

.tour-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #4A90E2;
}

.stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tour-config {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
}

.tour-config span {
    display: block;
    margin-bottom: 4px;
}

.tour-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tour-status.active {
    background: #C6F6D5;
    color: #22543D;
}

.tour-status.inactive {
    background: #FED7D7;
    color: #742A2A;
}

.tour-card-actions {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.tour-card-actions .btn {
    flex: 1;
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-state p {
    color: #666;
    margin-bottom: 20px;
}

/* Formulaires */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4A90E2;
}

.form-group small {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

/* Boutons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: #fff;
}

.btn-primary:hover {
    background: #357ABD;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #E53E3E;
    color: #fff;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 18px;
    color: #1a1a1a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

#tour-form {
    padding: 24px;
}

/* Code d'intégration */
.embed-content {
    padding: 24px;
}

.code-block {
    position: relative;
    background: #2D3748;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.code-block pre {
    color: #E2E8F0;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

.embed-options {
    margin-top: 24px;
}

.embed-options h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #333;
}

.embed-options .form-group {
    display: inline-block;
    width: calc(50% - 8px);
    margin-right: 16px;
}

.embed-preview {
    margin-top: 24px;
}

.embed-preview h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}

.embed-link {
    color: #4A90E2;
    word-break: break-all;
}

/* Erreurs */
.error {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
    color: #C53030;
    font-size: 13px;
}

/* Succès */
.success {
    background: #F0FFF4;
    border: 1px solid #C6F6D5;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
    color: #22543D;
    font-size: 13px;
}

/* Alertes */
.alert {
    padding: 16px 24px;
    margin: 0;
    font-size: 14px;
}

.alert-warning {
    background: #FFFBEB;
    border-bottom: 1px solid #FCD34D;
    color: #92400E;
}

.alert a {
    color: inherit;
    font-weight: 600;
}

/* Section de formulaire */
.form-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 16px;
}

#settings-form {
    padding: 24px;
}

/* Onglets */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #4A90E2;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #4A90E2;
}

.tab-content {
    display: block;
}

/* Actions avec plusieurs éléments */
.actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

/* Tableau de données */
.table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    color: #333;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table .code-cell {
    font-family: monospace;
    font-size: 11px;
    color: #666;
}

.data-table .date-cell {
    font-size: 12px;
    color: #888;
}

.data-table .tour-cell {
    font-size: 12px;
    color: #4A90E2;
}

.data-table .expired {
    color: #E53E3E;
}

.data-table .valid {
    color: #38A169;
}

.data-table .archived-row {
    background: #f5f5f5;
    opacity: 0.7;
}

.data-table .archived-row:hover {
    opacity: 1;
}

/* Utilitaires */
.hidden {
    display: none !important;
}

/* Badges utilisateurs */
.user-role {
    font-size: 11px;
    color: #4A90E2;
    font-weight: 600;
}

.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge.admin {
    background: #E9D8FD;
    color: #553C9A;
}

.role-badge.user {
    background: #BEE3F8;
    color: #2A4365;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.active {
    background: #C6F6D5;
    color: #22543D;
}

.status-badge.inactive {
    background: #FED7D7;
    color: #742A2A;
}

#profile-form {
    padding: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .tours-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 12px;
    }

    .actions-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}
