/* ============================================================
   EvoluFit Pro Admin - Styles
   ============================================================ */

:root {
    --primary: #00FF88;
    --primary-dark: #00CC6A;
    --secondary: #1A1A1A;
    --background: #0A0A0A;
    --surface: #141414;
    --surface-light: #1E1E1E;
    --text: #FFFFFF;
    --text-muted: #888888;
    --border: #2A2A2A;
    
    --success: #00FF88;
    --warning: #FFD700;
    --danger: #FF4444;
    --info: #00C8FF;
    
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   Login Screen
   ============================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--background) 0%, var(--secondary) 100%);
    padding: 20px;
}

.login-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

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

.logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

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

.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-top: 15px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

/* ============================================================
   App Layout
   ============================================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header i {
    font-size: 28px;
    color: var(--primary);
}

.sidebar-header span {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--surface-light);
    color: var(--text);
}

.nav-item.active {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info span {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-info small {
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================================
   Main Content
   ============================================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: var(--surface);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h2 {
    font-size: 24px;
    font-weight: 600;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-online {
    background: rgba(0, 255, 136, 0.1);
    color: var(--success);
}

.status-online i {
    font-size: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================
   Pages
   ============================================================ */

.page {
    display: none;
    padding: 30px;
    flex: 1;
}

.page.active {
    display: block;
}

/* ============================================================
   Dashboard
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: rgba(0, 200, 255, 0.1); color: var(--info); }
.stat-icon.green { background: rgba(0, 255, 136, 0.1); color: var(--success); }
.stat-icon.purple { background: rgba(131, 56, 236, 0.1); color: #8338EC; }
.stat-icon.orange { background: rgba(255, 107, 53, 0.1); color: #FF6B35; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-info small {
    font-size: 12px;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 25px;
}

/* Integrations List */

.integrations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.integration-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--surface-light);
    border-radius: 8px;
}

.integration-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.integration-info i {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.integration-info span {
    font-weight: 500;
}

.integration-info small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-active { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-error { background: var(--danger); }
.status-pending { background: var(--warning); }

/* Metrics */

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-value {
    font-weight: 600;
    color: var(--primary);
}

/* ============================================================
   Integrations Page
   ============================================================ */

.integrations-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.integration-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 25px;
    transition: var(--transition);
}

.integration-card:hover {
    border-color: var(--primary);
}

.integration-card.inactive {
    opacity: 0.6;
}

.integration-card .card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 15px;
}

.integration-card .card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.integration-card .card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge-success {
    background: rgba(0, 255, 136, 0.1);
    color: var(--success);
}

.status-badge-error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge-pending {
    background: rgba(255, 215, 0, 0.1);
    color: var(--warning);
}

.integration-card h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.integration-card p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.card-actions {
    display: flex;
    gap: 10px;
}

/* ============================================================
   Modal
   ============================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

.modal-header h3 {
    font-size: 18px;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.test-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

.test-result.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--success);
}

.test-result.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--danger);
}

/* ============================================================
   Forms
   ============================================================ */

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* Toggle Switch */

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background: var(--surface-light);
    border-radius: 13px;
    position: relative;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-label input:checked + .toggle-slider {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--primary);
}

.toggle-label input:checked + .toggle-slider::after {
    background: var(--primary);
    transform: translateX(24px);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
}

.btn-icon:hover {
    color: var(--text);
    background: var(--surface-light);
}

.btn-block {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   Tables
   ============================================================ */

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

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: var(--surface-light);
}

/* ============================================================
   Section Title
   ============================================================ */

.section-title {
    font-size: 16px;
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   Toast Notifications
   ============================================================ */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    border-radius: 8px;
    padding: 15px 20px;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .integrations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-header span,
    .nav-item span,
    .user-info {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .integrations-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .top-bar h2 {
        font-size: 18px;
        margin-left: 50px;
    }
    
    .page {
        padding: 20px;
    }
    
    .modal-content {
        max-width: 95vw;
        margin: 20px;
    }
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page.active {
    animation: fadeIn 0.3s ease;
}

/* Loading */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Page Loading State */
.page.loading {
    position: relative;
    min-height: 400px;
}

.page.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-light) 25%,
        var(--surface) 50%,
        var(--surface-light) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error States */
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.error-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--danger);
}

.error-state h3 {
    margin-bottom: 10px;
    color: var(--text);
}

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

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 101;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
}
