/**
 * ALFAMEDIC Portail Médecin - Styles CSS
 * Design uniforme avec le LIMS (patients.php, analyses.php, medecins.php)
 */

/* ===== RESET & BASE ===== */
#alfamedic-portail-login *,
#alfamedic-dashboard *,
#alfamedic-portail * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#alfamedic-portail-login,
#alfamedic-dashboard,
#alfamedic-portail {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #333;
    line-height: 1.5;
}

/* ============================================
   LOGIN PAGE - Style identique au LIMS
   ============================================ */

#alfamedic-portail-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #3182ce 100%);
    padding: 20px;
}

.portail-login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

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

/* Header Login */
.portail-login-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 40px 30px;
    text-align: center;
    color: white;
}

.portail-login-header.otp {
    padding: 30px;
}

.portail-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.portail-logo i {
    font-size: 2.5rem;
    color: #1e3a5f;
}

.portail-logo.otp {
    background: rgba(255,255,255,0.15);
}

.portail-logo.otp i {
    color: #27ae60;
}

.portail-login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.portail-login-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px;
    opacity: 0.95;
}

.portail-login-header p {
    opacity: 0.85;
    font-size: 0.9rem;
    margin: 0;
}

.portail-email-masked {
    font-family: monospace;
    background: rgba(255,255,255,0.15);
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Body Login */
.portail-login-body {
    padding: 40px 30px;
}

.portail-form-group {
    margin-bottom: 25px;
}

.portail-form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.portail-input-group {
    position: relative;
}

.portail-input-group > i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.1rem;
}

.portail-input-group input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.portail-input-group input:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

.portail-input-group input::placeholder {
    color: #aaa;
}

.portail-toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
}

.portail-toggle-password:hover {
    color: #1e3a5f;
}

/* OTP Inputs */
.portail-otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.portail-otp-inputs .otp-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s;
}

.portail-otp-inputs .otp-input:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}

.portail-otp-inputs .otp-input.filled {
    background: #f0f9ff;
    border-color: #27ae60;
}

.portail-otp-timer {
    text-align: center;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.portail-otp-timer #otp-timer {
    font-weight: 700;
    color: #1e3a5f;
}

/* Error Messages */
.portail-form-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

/* Buttons */
.portail-btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.portail-btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(30, 58, 95, 0.4);
}

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

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

.portail-btn-link {
    background: none;
    border: none;
    color: #1e3a5f;
    cursor: pointer;
    padding: 10px 15px;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.portail-btn-link:hover {
    color: #2c5282;
    text-decoration: underline;
}

.portail-otp-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Footer Login */
.portail-login-footer {
    text-align: center;
    padding: 20px 30px 30px;
    border-top: 1px solid #eee;
    background: #f8fafc;
}

.portail-lang-switch {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.portail-lang-switch a {
    font-size: 1.8rem;
    opacity: 0.5;
    transition: all 0.3s;
    text-decoration: none;
}

.portail-lang-switch a:hover,
.portail-lang-switch a.active {
    opacity: 1;
    transform: scale(1.1);
}

.portail-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d1fae5;
    color: #059669;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.portail-contact {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 10px 0;
}

.portail-contact a {
    color: #1e3a5f;
    text-decoration: none;
    font-weight: 500;
}

.portail-contact a:hover {
    text-decoration: underline;
}

.portail-copyright {
    color: #999;
    font-size: 0.8rem;
    margin: 0;
}

/* ============================================
   DASHBOARD - Style identique au LIMS
   ============================================ */

#alfamedic-dashboard {
    background: #f8fafc;
    min-height: 100vh;
}

/* Header Dashboard - Identique LIMS */
.portail-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.portail-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.portail-brand i {
    font-size: 1.5rem;
}

.portail-brand span {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.portail-search-global {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.portail-search-global i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.portail-search-global input {
    width: 100%;
    padding: 10px 15px 10px 42px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.95);
    font-size: 0.9rem;
}

.portail-search-global input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

/* User Menu */
.portail-user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.portail-user-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.portail-user-info {
    display: flex;
    flex-direction: column;
    color: #fff;
}

.portail-user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.portail-user-specialty {
    font-size: 0.75rem;
    opacity: 0.8;
}

.portail-dropdown-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px 10px;
}

.portail-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.portail-dropdown-menu.show {
    display: block;
}

.portail-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #334155;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
}

.portail-dropdown-item:hover {
    background: #f1f5f9;
}

.portail-dropdown-item.logout {
    color: #dc2626;
}

.portail-dropdown-menu hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #e2e8f0;
}

/* Navigation - Identique LIMS */
.portail-nav {
    background: #fff;
    padding: 0 25px;
    display: flex;
    gap: 5px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.portail-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.portail-nav-item:hover {
    color: #1e3a5f;
}

.portail-nav-item.active {
    color: #1e3a5f;
    border-bottom-color: #1e3a5f;
}

/* Main Content */
.portail-main {
    padding: 25px;
}

/* Welcome */
.portail-welcome {
    margin-bottom: 25px;
}

.portail-welcome h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 5px 0;
}

.portail-welcome p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

/* Stats Grid - Identique LIMS */
.portail-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.portail-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 4px solid #1e3a5f;
    transition: all 0.2s;
}

.portail-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

.portail-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.portail-stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e3a5f;
    line-height: 1;
}

.portail-stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards - Identique LIMS */
.portail-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.portail-card-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portail-card-header h3 {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.portail-card-header.alert {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.portail-card-header .portail-btn-link {
    color: rgba(255,255,255,0.9);
}

.portail-card-header .portail-btn-link:hover {
    color: #fff;
}

.portail-card-body {
    padding: 0;
}

/* Dashboard Grid */
.portail-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

/* Table - Identique LIMS */
.portail-table {
    width: 100%;
    border-collapse: collapse;
}

.portail-table thead th {
    background: #f1f5f9;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
}

.portail-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.portail-table tbody tr:hover {
    background: #f8fafc;
}

.portail-table tbody td {
    padding: 12px 15px;
    font-size: 0.9rem;
    vertical-align: middle;
    color: #334155;
}

.portail-patient-cell strong {
    display: block;
    color: #1e293b;
}

.portail-patient-cell small {
    color: #64748b;
    font-size: 0.8rem;
}

/* Badges - Identique LIMS */
.portail-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.portail-badge.success {
    background: #d1fae5;
    color: #059669;
}

.portail-badge.warning {
    background: #fef3c7;
    color: #d97706;
}

.portail-badge.danger {
    background: #fee2e2;
    color: #dc2626;
}

.portail-badge.info {
    background: #dbeafe;
    color: #1d4ed8;
}

/* Actions - Identique LIMS */
.portail-actions {
    display: flex;
    gap: 6px;
}

.portail-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.portail-action-btn.view {
    background: #dbeafe;
    color: #1e40af;
}

.portail-action-btn.view:hover {
    background: #bfdbfe;
}

.portail-action-btn.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.portail-action-btn.pdf:hover {
    background: #fecaca;
}

/* Alert List */
.portail-alert-list {
    padding: 10px 0;
}

.portail-alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.portail-alert-item:hover {
    background: #f8fafc;
}

.portail-alert-item:last-child {
    border-bottom: none;
}

.portail-alert-icon {
    width: 40px;
    height: 40px;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.portail-alert-content {
    flex: 1;
}

.portail-alert-content strong {
    display: block;
    color: #1e293b;
    font-size: 0.9rem;
}

.portail-alert-analyse {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin: 3px 0;
}

.portail-alert-analyse .abnormal {
    color: #dc2626;
    font-weight: 600;
}

.portail-alert-content small {
    color: #94a3b8;
    font-size: 0.8rem;
}

.portail-alert-action {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portail-alert-action:hover {
    background: #1e3a5f;
    color: #fff;
}

/* Empty State */
.portail-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.portail-empty i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 15px;
}

.portail-empty.success i {
    color: #059669;
}

.portail-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Modal - Identique LIMS */
.portail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.portail-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}

.portail-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.portail-modal-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portail-modal-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.1rem;
}

.portail-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 5px;
}

.portail-modal-close:hover {
    opacity: 1;
}

.portail-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.portail-modal-footer {
    padding: 15px 25px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Buttons */
.portail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.portail-btn.primary {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: #fff;
}

.portail-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30,58,95,0.3);
}

.portail-btn.secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.portail-btn.secondary:hover {
    background: #e2e8f0;
}

.portail-btn.small {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .portail-login-card {
        border-radius: 15px;
    }
    
    .portail-login-header {
        padding: 30px 20px;
    }
    
    .portail-login-body {
        padding: 30px 20px;
    }
    
    .portail-otp-inputs .otp-input {
        width: 42px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .portail-header {
        flex-direction: column;
        padding: 15px;
    }
    
    .portail-search-global {
        max-width: 100%;
        order: 3;
        margin-top: 10px;
    }
    
    .portail-user-info {
        display: none;
    }
    
    .portail-nav {
        overflow-x: auto;
        padding: 0 15px;
    }
    
    .portail-main {
        padding: 15px;
    }
    
    .portail-dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .portail-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #alfamedic-portail-login {
        padding: 15px;
    }
    
    .portail-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .portail-stat-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
}
