:root {
    --primary: #2c5aa0;
    --secondary: #00d4ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.dashboard-header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInDown 0.8s ease;
}

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

.logo-section h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.logo-section p {
    color: #6b7280;
    font-size: 1.1rem;
}

.stats-overview {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    text-align: center;
    min-width: 150px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Main Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 25px;
    margin-bottom: 25px;
}

/* Map Section */
.map-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow);
    animation: fadeInLeft 0.8s ease;
    height: 600px;
    display: flex;
    flex-direction: column;
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--secondary);
}

#gatewayMap {
    flex: 1;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Devices Section */
.devices-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow);
    animation: fadeInRight 0.8s ease;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.devices-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.device-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--success);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.device-card:hover::before {
    left: 100%;
}

.device-card:hover {
    transform: translateY(-5px) translateX(5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.device-card:active {
    transform: scale(0.98);
}

.device-card.offline {
    border-left-color: var(--danger);
    opacity: 0.7;
}

.device-card.active {
    border-left-color: var(--primary);
    background: linear-gradient(135deg, #ffffff, #f0f7ff);
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.2);
}

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

.device-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
}

.device-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-online {
    background: var(--success);
    color: white;
}

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

.device-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
    color: #6b7280;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-item i {
    color: var(--primary);
    width: 16px;
}

.device-click-hint {
    margin-top: 15px;
    padding: 8px 12px;
    background: rgba(44, 90, 160, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.device-card:hover .device-click-hint {
    background: rgba(44, 90, 160, 0.2);
    transform: translateX(5px);
}

/* Device Selector */
.device-selector {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.8s ease;
}

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

.device-dropdown {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

/* Metrics Section */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.8s ease;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-card:nth-child(1) {
    animation-delay: 0.1s;
}

.metric-card:nth-child(2) {
    animation-delay: 0.2s;
}

.metric-card:nth-child(3) {
    animation-delay: 0.3s;
}

.metric-chart {
    height: 250px;
    margin-top: 15px;
}

.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    text-align: center;
}

.no-data i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.3);
}

/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .stats-overview {
        justify-content: center;
    }

    .dashboard-container {
        padding: 10px;
    }

    .map-section,
    .devices-section {
        height: 500px;
    }

    .metric-card {
        padding: 20px;
    }

    .metric-chart {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        min-width: 120px;
        padding: 12px 20px;
    }

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

    .logo-section h1 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .device-details {
        grid-template-columns: 1fr;
    }
}