/* Blue Mogul Client Portal - Admindek Theme */

:root {
    --primary-color: #4680ff;
    --primary-light: #6993ff;
    --primary-dark: #3366cc;
    --secondary-color: #5c6bc0;
    --accent-color: #7c4dff;
    
    --success-color: #2ed8b6;
    --warning-color: #ffb64d;
    --error-color: #ff5370;
    --info-color: #00bcd4;
    
    --text-primary: #1e2022;
    --text-secondary: #6c757d;
    --text-light: #adb5bd;
    --text-inverse: #ffffff;
    
    --bg-primary: #f4f7fa;
    --bg-card: #ffffff;
    --bg-dark: #1c232f;
    --bg-sidebar: #1c232f;
    --bg-sidebar-hover: #262d3a;
    
    --border-color: #e9ecef;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --sidebar-width: 280px;
    --topbar-height: 70px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    --gradient-primary: linear-gradient(135deg, #4680ff 0%, #7c4dff 100%);
    --gradient-success: linear-gradient(135deg, #2ed8b6 0%, #17a689 100%);
    --gradient-warning: linear-gradient(135deg, #ffb64d 0%, #ff9800 100%);
    --gradient-danger: linear-gradient(135deg, #ff5370 0%, #ff1744 100%);
}

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

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.loading-spinner .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

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

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    background-image: 
        radial-gradient(ellipse at top left, rgba(70, 128, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(124, 77, 255, 0.15) 0%, transparent 50%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 42px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-image {
    max-width: 220px;
    height: auto;
}

.logo-image-sidebar {
    max-width: 160px;
    height: auto;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg-card);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(70, 128, 255, 0.15);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 12px;
}

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

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

.btn .material-icons {
    font-size: 18px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(70, 128, 255, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(70, 128, 255, 0.45);
}

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

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

.btn-success {
    background: var(--gradient-success);
    color: var(--text-inverse);
}

.btn-danger {
    background: var(--gradient-danger);
    color: var(--text-inverse);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--primary-color);
    background: rgba(70, 128, 255, 0.1);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    position: relative;
}

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

.btn-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    border-radius: 9px;
}

.btn-block {
    width: 100%;
}

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

/* Auth Footer */
.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.support-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.support-link .material-icons {
    font-size: 18px;
    color: var(--text-light);
}

/* Portal Layout */
#portal {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo {
    justify-content: flex-start;
}

.sidebar-header .logo-icon {
    font-size: 32px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header .logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-inverse);
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: var(--border-radius-sm);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(70, 128, 255, 0.3);
}

.nav-item .material-icons {
    font-size: 22px;
    opacity: 0.9;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--error-color);
    color: var(--text-inverse);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-sidebar-hover);
    margin-bottom: 12px;
}

.user-avatar .material-icons {
    font-size: 40px;
    color: var(--primary-color);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-inverse);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .btn-text {
    width: 100%;
    justify-content: center;
    color: rgba(255,255,255,0.6);
}

.sidebar-footer .btn-text:hover {
    color: var(--text-inverse);
    background: var(--bg-sidebar-hover);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.mobile-menu-toggle {
    display: none;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-btn {
    color: var(--text-secondary);
    font-weight: 500;
}

.phone-btn .material-icons {
    color: var(--success-color);
}

/* Content Area */
.content-area {
    padding: 24px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
}

.stat-card:nth-child(2)::before {
    background: var(--gradient-success);
}

.stat-card:nth-child(3)::before {
    background: var(--gradient-warning);
}

.stat-card:nth-child(4)::before {
    background: var(--gradient-danger);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(70, 128, 255, 0.1);
}

.stat-icon .material-icons {
    font-size: 28px;
    color: var(--primary-color);
}

.stat-card:nth-child(2) .stat-icon {
    background: rgba(46, 216, 182, 0.1);
}

.stat-card:nth-child(2) .stat-icon .material-icons {
    color: var(--success-color);
}

.stat-card:nth-child(3) .stat-icon {
    background: rgba(255, 182, 77, 0.1);
}

.stat-card:nth-child(3) .stat-icon .material-icons {
    color: var(--warning-color);
}

.stat-card:nth-child(4) .stat-icon {
    background: rgba(255, 83, 112, 0.1);
}

.stat-card:nth-child(4) .stat-icon .material-icons {
    color: var(--error-color);
}

.stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* Dashboard Section */
.dashboard-section {
    margin-bottom: 24px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 16px;
}

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

.empty-state small {
    color: var(--text-light);
}

/* Settings Form */
.settings-form {
    max-width: 600px;
}

.card-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin: -8px 0 20px 0;
}

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

.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.form-actions .btn .material-icons {
    font-size: 18px;
}

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

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    background: var(--primary-color);
    color: var(--text-inverse);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* Notification Panel */
.notification-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    right: 0;
}

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

.panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--info-color);
}

.toast .material-icons {
    font-size: 22px;
}

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

.toast-success .material-icons {
    color: var(--success-color);
}

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

.toast-error .material-icons {
    color: var(--error-color);
}

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

.toast-warning .material-icons {
    color: var(--warning-color);
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Admin Page Styles */
.admin-notice {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: rgba(70, 128, 255, 0.08);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 24px;
}

.admin-notice .material-icons {
    color: var(--primary-color);
    font-size: 24px;
    margin-top: 2px;
}

.admin-notice p {
    margin-top: 4px;
    color: var(--text-secondary);
}

.integration-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.integration-card {
    border: 1px solid var(--border-color);
}

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

.integration-header h3 {
    margin: 0;
    font-size: 18px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-connected {
    background: rgba(46, 216, 182, 0.15);
    color: #17a689;
}

.status-configured {
    background: rgba(255, 182, 77, 0.15);
    color: #cc8800;
}

.status-unconfigured {
    background: var(--bg-primary);
    color: var(--text-light);
}

.integration-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.integration-fields {
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
}

.integration-field {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.integration-field:last-child {
    border-bottom: none;
}

.integration-field strong {
    min-width: 100px;
    color: var(--text-secondary);
}

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

.test-result {
    margin-top: 12px;
    font-size: 13px;
}

.test-result .testing {
    color: var(--text-secondary);
}

.test-result .test-success {
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.test-result .test-error {
    color: var(--error-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.test-result .material-icons {
    font-size: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        left: calc(var(--sidebar-width) * -1);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .integration-cards {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .phone-number {
        display: none;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-actions .btn {
        width: 100%;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 24px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}
