/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0D47A1;
    --primary-dark: #002171;
    --secondary-color: #1976D2;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --info-color: #2196F3;
    --dark-bg: #1a1a2e;
    --sidebar-bg: #16213e;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --text-primary: #212121;
    --text-secondary: #757575;
    --admin-primary: #DC143C;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    max-width: 1200px;
    width: 100%;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

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

.login-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
}

.tab-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
}

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

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

.form-group input,
.form-group select,
.filter-select,
.filter-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.error-message {
    padding: 12px;
    background: #ffebee;
    color: var(--danger-color);
    border-radius: 8px;
    margin-top: 16px;
    display: none;
}

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

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

.feature {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    color: white;
}

.feature i {
    font-size: 36px;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar.admin {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

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

.sidebar-header i {
    font-size: 28px;
}

.sidebar-header h2 {
    font-size: 20px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--primary-color);
}

.sidebar.admin .nav-item.active {
    border-left-color: var(--admin-primary);
}

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

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

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s;
}

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

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px;
    background: #f5f7fa;
}

.dashboard-header {
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-left h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

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

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

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f5f7fa;
    border-radius: 8px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    width: 200px;
}

.notification-icon {
    position: relative;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
}

.notification-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

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

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

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

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-change {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-change.positive {
    color: var(--success-color);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chart-card.status-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 360px;
    max-width: none;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chart-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    position: relative;
}

.chart-body canvas {
    width: 100% !important;
    max-width: 320px;
    height: 320px !important;
    max-height: 320px;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
    background: #fafbff;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.legend-dot.completed { background: #2e7d32; }
.legend-dot.pending { background: #f57c00; }
.legend-dot.failed { background: #c62828; }
.legend-dot.other { background: #90a4ae; }

.chart-card.large {
    grid-column: 1 / -1;
}

.chart-card h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

/* Analytics Section */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.analytics-block {
    margin-top: 24px;
}

.analytics-block h2 {
    margin-bottom: 16px;
}

.analytics-card {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.analytics-card canvas {
    width: 100% !important;
    max-width: 720px;
    height: 240px !important;
    max-height: 240px;
    margin: 0 auto;
}

/* Tables */
.table-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 24px;
}

.overview-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

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

.card-header.compact {
    padding: 16px 20px;
    background: #fafbff;
}

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

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.table-container {
    overflow-x: auto;
}

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

.data-table th {
    background: #f5f7fa;
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

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

.status-badge.completed { background: #e8f5e9; color: #2e7d32; }
.status-badge.pending { background: #fff3e0; color: #f57c00; }
.status-badge.failed { background: #ffebee; color: #c62828; }

/* Form Card */
.form-card {
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-width: 800px;
}

.form-card h2 {
    margin-bottom: 24px;
    font-size: 22px;
}

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

/* Balance Cards */
.balance-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.balance-card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    opacity: 0.9;
}

.balance-card h1 {
    font-size: 48px;
    margin-bottom: 16px;
}

.balance-details {
    background: white;
    padding: 32px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

/* API Settings */
.api-settings {
    display: grid;
    gap: 24px;
}

.api-card {
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.api-card h2 {
    margin-bottom: 24px;
    font-size: 20px;
}

.credential-item {
    margin-bottom: 20px;
}

.credential-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.credential-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.credential-value code {
    flex: 1;
    padding: 12px 16px;
    background: #f5f7fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.btn-copy {
    padding: 12px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: var(--primary-dark);
}

/* Filters */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-select, .filter-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

/* Activity Grid */
.activity-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.alert-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.alert-card.enhanced {
    padding: 0;
    overflow: hidden;
}

.alert-card h3 {
    margin-bottom: 16px;
}

.alerts-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.alert-item:last-child { margin-bottom: 0; }

.alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(33, 150, 243, 0.12);
    color: var(--info-color);
}

.alert-item.success .alert-icon {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}

.alert-item.warning .alert-icon {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-color);
}

.alert-content p {
    font-weight: 600;
    margin-bottom: 2px;
}

.alert-content span {
    font-size: 12px;
    color: var(--text-secondary);
}

.alert-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3949ab;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-header h2,
    .nav-item span,
    .btn-logout span {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
    }

    .overview-duo {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .overview-duo {
        grid-template-columns: 1fr;
    }

    .chart-card.status-card {
        min-height: 320px;
    }

    .chart-body canvas {
        max-width: 260px;
        height: 260px !important;
    }

    .analytics-card {
        min-height: 300px;
    }

    .analytics-card canvas {
        height: 220px !important;
    }
}
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

.text-center {
    text-align: center;
}
