/**
 * Common CSS - Styles et composants partagés
 * OpenThread IoT Control Center
 */

/* Variables CSS communes */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-color: #f8fafc;
    --card-bg: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;
    --border-radius: 10px;
    --border-radius-lg: 15px;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.2);

    --transition: all 0.3s ease;
}

/* Reset minimal pour compatibilité */
.nav-container, .nav-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Menu de navigation principal */
.nav-container {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    background: var(--bg-gradient);
}

.nav-item {
    flex: 1;
    min-width: 120px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    border-bottom-color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.2rem;
}

/* Bouton d'action dans le menu de navigation */
.nav-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    width: 100%;
    font-family: inherit;
}

.nav-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.nav-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nav-action-btn.loading .nav-icon {
    animation: spin 1s linear infinite;
}

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

/* Menu burger pour mobile */
.nav-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 1.5rem;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

/* Responsive */
@media (max-width: 1024px) {
    .nav-menu {
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .nav-menu.active {
        max-height: 600px;
    }

    .nav-toggle {
        display: block;
    }

    .nav-item {
        flex: none;
        width: 100%;
    }

    .nav-link {
        justify-content: flex-start;
        padding: 12px 20px;
    }
}

/* Boutons communs - styles harmonisés */
.btn-common {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-common:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-common:active {
    transform: translateY(0);
}

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

.btn-primary-common:hover {
    background: #5568d3;
}

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

.btn-success-common:hover {
    background: #059669;
}

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

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

/* Cartes communes */
.card-common {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card-common:hover {
    box-shadow: var(--shadow-lg);
}

/* Headers communs */
.page-header-common {
    background: var(--bg-gradient);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.page-title-common {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 700;
}

.page-subtitle-common {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 10px;
}

/* Status badges communs */
.status-badge-common {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-connected {
    background: var(--success-color);
    color: white;
}

.status-disconnected {
    background: var(--error-color);
    color: white;
}

.status-warning {
    background: var(--warning-color);
    color: white;
}

/* Animations communes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Utilitaires */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Container responsive commun */
.container-common {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 768px) {
    .container-common {
        padding: 15px;
    }

    .page-title-common {
        font-size: 1.8rem;
    }

    .page-subtitle-common {
        font-size: 1rem;
    }
}
