/* Dashboard Styles - Fully Responsive */

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

:root {
    --primary-color: #ff0033;
    --secondary-color: #1a1a2e;
    --success-color: #00d4aa;
    --warning-color: #ffa500;
    --danger-color: #ff4757;
    --info-color: #3498db;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--primary-color);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(255, 0, 51, 0.3);
    transition: var(--transition);
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--secondary-color) 0%, #0f0f1e 100%);
    color: white;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff0033, #ff3366);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.sidebar-menu {
    flex: 1;
    list-style: none;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-menu li.active a {
    background: rgba(255, 0, 51, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

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

.user-profile,
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    margin-bottom: 10px;
}

.user-profile:hover,
.logout-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    transition: var(--transition);
}

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

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--secondary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-switch {
    display: flex;
    gap: 5px;
    background: white;
    padding: 4px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lang-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    transition: var(--transition);
}

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

.notification-btn {
    position: relative;
    background: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.notification-btn:hover {
    transform: scale(1.05);
}

.notification-btn i {
    font-size: 20px;
    color: var(--text-color);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

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

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 20px;
    transition: var(--transition);
}

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

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

.stat-card-primary .stat-icon {
    background: rgba(255, 0, 51, 0.1);
    color: var(--primary-color);
}

.stat-card-danger .stat-icon {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger-color);
}

.stat-card-success .stat-icon {
    background: rgba(0, 212, 170, 0.1);
    color: var(--success-color);
}

.stat-card-warning .stat-icon {
    background: rgba(255, 165, 0, 0.1);
    color: var(--warning-color);
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.stat-change {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

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

.stat-change.negative {
    color: var(--danger-color);
}

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

.chart-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
}

.chart-card canvas {
    max-height: 300px;
}

/* Activity Section */
.activity-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.recent-activity,
.alerts-panel {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.recent-activity h3,
.alerts-panel h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
}

.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.critical {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger-color);
}

.activity-icon.success {
    background: rgba(0, 212, 170, 0.1);
    color: var(--success-color);
}

.activity-icon.warning {
    background: rgba(255, 165, 0, 0.1);
    color: var(--warning-color);
}

.activity-icon.info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info-color);
}

.activity-content p {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-light);
}

/* Alert Items */
.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 4px solid;
}

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

.alert-critical {
    background: rgba(255, 71, 87, 0.05);
    border-left-color: var(--danger-color);
}

.alert-high {
    background: rgba(255, 165, 0, 0.05);
    border-left-color: var(--warning-color);
}

.alert-medium {
    background: rgba(52, 152, 219, 0.05);
    border-left-color: var(--info-color);
}

.alert-item i {
    font-size: 24px;
    color: inherit;
}

.alert-content {
    flex: 1;
}

.alert-content strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.alert-content p {
    font-size: 13px;
    color: var(--text-light);
}

.alert-btn {
    padding: 8px 16px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.alert-btn:hover {
    background: #cc0029;
    transform: scale(1.05);
}

/* Quick Actions */
.quick-actions {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quick-actions h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), #ff3366);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(255, 0, 51, 0.2);
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(255, 0, 51, 0.3);
}

.action-btn i {
    font-size: 32px;
}

.action-btn span {
    font-size: 14px;
    font-weight: 600;
}

/* Logic Button Styles */
.logic-btn {
    background: linear-gradient(135deg, #ff0033 0%, #ff3366 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(255, 0, 51, 0.3);
    white-space: nowrap;
}

.logic-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 51, 0.4);
}

.logic-btn i {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .activity-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 80px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .logic-btn {
        padding: 8px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    .logic-btn span {
        display: inline;
    }

    .lang-switch {
        order: 1;
    }

    .notification-btn {
        order: 2;
    }

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

    .charts-row {
        grid-template-columns: 1fr;
    }

    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        margin: 0 auto;
    }

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

    .activity-item {
        flex-direction: column;
        text-align: center;
    }

    .activity-icon {
        margin: 0 auto;
    }

    .alert-item {
        flex-direction: column;
        text-align: center;
    }

    .logic-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .logic-btn i {
        font-size: 14px;
    }
}

/* Modal Overlay and Logic Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.logic-modal {
    background: linear-gradient(135deg, #131318 0%, #1a1a2e 100%);
    border: 2px solid rgba(255, 0, 51, 0.3);
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    color: #ffffff;
}

.modal-overlay.active .logic-modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 0, 51, 0.3);
    transform: rotate(90deg);
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
}

.modal-header p {
    color: #a0a0b8;
    font-size: 16px;
}

.logic-section {
    margin-bottom: 25px;
}

.logic-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #ff0033;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logic-section p {
    color: #e0e0e8;
    line-height: 1.8;
    margin-bottom: 15px;
}

.logic-section ul {
    color: #e0e0e8;
    line-height: 2;
    margin-left: 20px;
}

.logic-highlight {
    background: rgba(255, 0, 51, 0.1);
    border-left: 3px solid #ff0033;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.logic-highlight strong {
    color: #ff0033;
}

.logic-highlight p {
    margin: 0;
    color: #e0e0e8;
}

/* Modal Mobile Responsive */
@media (max-width: 768px) {
    .logic-modal {
        width: 95%;
        max-height: 90vh;
        padding: 25px;
        border-radius: 15px;
    }

    .modal-header h2 {
        font-size: 22px;
        padding-right: 30px;
    }

    .modal-header p {
        font-size: 14px;
    }

    .logic-section h3 {
        font-size: 16px;
    }

    .logic-section p, .logic-section ul {
        font-size: 14px;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 18px;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .logic-modal {
        width: 98%;
        padding: 20px;
        max-height: 92vh;
    }

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

    .modal-header p {
        font-size: 13px;
    }

    .logic-section h3 {
        font-size: 15px;
    }

    .logic-section p, .logic-section ul {
        font-size: 13px;
        line-height: 1.6;
    }

    .logic-highlight {
        padding: 12px 15px;
    }
}

/* Development Banner - Minimal Style */
.dev-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    color: #ff0033;
    padding: 6px 15px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dev-banner i {
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

/* Adjust main content to account for dev banner */
body {
    padding-top: 30px;
}

/* Language Switch Enhancements */
.lang-switch {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 8px;
}

.lang-btn {
    padding: 6px 14px;
    background: transparent;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    background: #ff0033;
    box-shadow: 0 2px 8px rgba(255, 0, 51, 0.3);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .dev-banner {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .dev-banner i {
        font-size: 14px;
    }
    
    body {
        padding-top: 35px;
    }
}

@media (max-width: 480px) {
    .dev-banner {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .dev-banner span {
        display: inline-block;
        max-width: 250px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ===================================
   RESPONSIVE DASHBOARD FIXES
   =================================== */

/* Mobile Responsive (< 768px) */
@media (max-width: 768px) {
    /* Dev Banner Mobile */
    .dev-banner {
        font-size: 10px;
        padding: 4px 10px;
    }
    
    .dev-banner span {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    body {
        padding-top: 25px;
    }
    
    /* Stats Grid - Stack on Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    /* Page Header Mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Language Switch Mobile */
    .lang-switch {
        gap: 3px;
        padding: 3px;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    /* Notification Button Mobile */
    .notification-btn {
        padding: 8px 12px;
    }
    
    /* Charts Container Mobile */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-card {
        padding: 15px;
    }
    
    .chart-card h3 {
        font-size: 16px;
    }
    
    /* Activity Feed Mobile */
    .dashboard-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .activity-feed,
    .alerts-panel {
        padding: 15px;
    }
    
    .activity-feed h3,
    .alerts-panel h3 {
        font-size: 16px;
    }
    
    .activity-item,
    .alert-item {
        padding: 12px;
        font-size: 13px;
    }
    
    /* Quick Actions Mobile */
    .quick-actions {
        padding: 20px;
    }
    
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .action-btn {
        padding: 15px 10px;
        font-size: 13px;
    }
    
    .action-btn i {
        font-size: 20px;
    }
}

/* Tablet Responsive (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Stats Grid - 2 Columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    /* Charts Grid - Stack on Tablet */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Dashboard Columns - Single Column */
    .dashboard-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Quick Actions - 2 Columns */
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .dev-banner {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    body {
        padding-top: 22px;
    }
    
    .page-header h1 {
        font-size: 18px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .stat-change {
        font-size: 11px;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        padding: 12px;
    }
}

/* Print Styles */
@media print {
    .dev-banner,
    .mobile-menu-toggle,
    .sidebar,
    .lang-switch,
    .notification-btn,
    .action-btn,
    .alert-btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    body {
        padding-top: 0;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .dev-banner {
        text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.15);
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    .dev-banner {
        color: #ff4757;
    }
}
