/* =========================
   Foomus Cloud Styles
   ========================= */

:root {
    --primary-color: #0d9488;
    --primary-hover: #0f766e;
    --accent-color: #6366f1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-bg: #134e4a;
    --sidebar-text: #d1d5db;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* =========================
   Landing Page
   ========================= */

.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d9488 0%, #4f46e5 100%);
}

.landing-container {
    text-align: center;
    color: white;
    padding: 2rem;
    max-width: 1200px;
}

.landing-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.landing-header p {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.cta-section {
    margin-top: 3rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.landing-footer {
    margin-top: 4rem;
    opacity: 0.8;
}

.landing-footer a {
    color: white;
    text-decoration: none;
}

/* =========================
   Login Page
   ========================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d9488 0%, #4f46e5 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.error-message {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 0.9rem;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-secondary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: white;
    border: 2px solid white;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

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

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

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.5rem;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
}

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

.nav-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: white;
    border-left: 3px solid var(--accent-color);
}

.nav-signout {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(239, 68, 68, 0.9) !important;
}

.nav-signout:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-header h1 {
    font-size: 2rem;
    margin: 0;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.user-badge::before {
    content: "👤";
    margin-right: 0.5rem;
}

.header-actions {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* =========================
   Stats Grid
   ========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-subtext {
    font-size: 0.85rem;
    color: var(--success-color);
}

/* =========================
   Sections
   ========================= */

.section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* =========================
   Gateways Grid
   ========================= */

.gateways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.gateway-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.gateway-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.gateway-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-online {
    background: #d1fae5;
    color: #065f46;
}

.status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.gateway-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.gateway-info div {
    margin-bottom: 0.25rem;
}

/* =========================
   Chart
   ========================= */

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

.chart-header h2 {
    margin: 0;
}

.time-range-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.time-btn {
    padding: 5px 12px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.time-btn:hover {
    background: #3a3a3a;
    color: #fff;
}

.time-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* =========================
   Alerts List
   ========================= */

.alerts-list {
    max-height: 400px;
    overflow-y: auto;
}

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

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

.alert-icon {
    font-size: 1.5rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* =========================
   Utility
   ========================= */

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* =========================
   Mobile Menu Toggle
   ========================= */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        padding: 1.5rem;
    }

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

    .content-header h1 {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .gateways-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

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

    .landing-header h1 {
        font-size: 2.5rem;
    }

    .landing-header p {
        font-size: 1.25rem;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .mobile-overlay.active {
        display: block;
    }

    .dashboard {
        flex-direction: row;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .main-content {
        width: 100%;
        padding: 1rem;
        padding-top: 4.5rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
    }

    .content-header h1 {
        font-size: 1.5rem;
        margin-top: 0.5rem;
    }

    .user-badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .header-actions {
        font-size: 0.85rem;
    }

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

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 2rem;
    }

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

    .section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .section h2 {
        font-size: 1.25rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Landing Page Mobile */
    .landing-container {
        padding: 1rem;
    }

    .landing-header h1 {
        font-size: 2rem;
    }

    .landing-header p {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 2rem 0;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .feature-icon {
        font-size: 2.5rem;
    }

    .feature-card h3 {
        font-size: 1.25rem;
    }

    .cta-section {
        flex-direction: column;
        margin-top: 2rem;
    }

    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }

    .landing-footer {
        margin-top: 2rem;
        font-size: 0.9rem;
    }

    /* Login Page Mobile */
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.75rem;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }

    .main-content {
        padding: 0.75rem;
        padding-top: 4rem;
    }

    .content-header h1 {
        font-size: 1.35rem;
    }

    .user-badge {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }

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

    .stat-value {
        font-size: 1.35rem;
    }

    .gateway-card {
        padding: 0.875rem;
    }

    .gateway-name {
        font-size: 1rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .chart-container {
        height: 200px;
    }

    .landing-header h1 {
        font-size: 1.75rem;
    }

    .landing-header p {
        font-size: 1rem;
    }

    .feature-icon {
        font-size: 2rem;
    }

    .feature-card h3 {
        font-size: 1.1rem;
    }

    .feature-card p {
        font-size: 0.9rem;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chart-container {
        height: 200px;
    }

    .main-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }

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