
:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #9b59b6;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #1a252f;
    --light: #ecf0f1;
    --glass: rgba(255, 255, 255, 0.08);
    --glass-light: rgba(255, 255, 255, 0.15);
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #2c3e50, #4a235a);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Mobile Header */
.mobile-header {
    background: rgba(26, 37, 47, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-logo i {
    font-size: 28px;
    color: var(--secondary);
    background: rgba(52, 152, 219, 0.15);
    width: 45px;
    height: 45px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-logo h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    background: linear-gradient(to right, var(--secondary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mobile-menu-btn {
    background: var(--glass);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 37, 47, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    cursor: pointer;
    min-width: 70px;
}

.nav-item.active {
    background: rgba(52, 152, 219, 0.15);
    color: white;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 5px;
}

/* Main Content */
.main-content {
    padding: 20px 15px 80px;
}

.header {
    margin-bottom: 25px;
}

.header h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 26px;
    background: linear-gradient(to right, white, #a5d8ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 15px;
}

.header-controls {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.btn {
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.btn:hover {
    background: var(--glass-light);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
}

/* View Container */
.view-container {
    display: none;
}

.view-container.active {
    display: block;
    animation: fadeIn 0.6s ease;
}

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

/* Dashboard View */
.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--glass);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
}

.stat-energy::before { background: linear-gradient(to right, #ff7e5f, #feb47b); }
.stat-devices::before { background: linear-gradient(to right, #00c9ff, #92fe9d); }
.stat-security::before { background: linear-gradient(to right, #834d9b, #d04ed6); }
.stat-temperature::before { background: linear-gradient(to right, #f46b45, #eea849); }

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-energy .stat-icon { background: rgba(255, 126, 95, 0.15); color: #ff7e5f; }
.stat-devices .stat-icon { background: rgba(0, 201, 255, 0.15); color: #00c9ff; }
.stat-security .stat-icon { background: rgba(131, 77, 155, 0.15); color: #834d9b; }
.stat-temperature .stat-icon { background: rgba(244, 107, 69, 0.15); color: #f46b45; }

.stat-title {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Montserrat', sans-serif;
}

.stat-trend {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.device-card {
    background: var(--glass);
    border-radius: 18px;
    padding: 18px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    background: var(--glass-light);
}

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

.device-icon {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(52, 152, 219, 0.15);
    color: var(--secondary);
}

.device-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.device-off .device-status {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Montserrat', sans-serif;
}

.device-location {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-location i {
    color: var(--accent);
    font-size: 12px;
}

/* Floor Plan View */
.floor-plan-container {
    background: var(--glass);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.floor-plan-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.floor-plan {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(12, 1fr);
    gap: 8px;
    height: 70vh;
    position: relative;
}

.room {
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}

.room:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.1), 0 3px 15px rgba(0, 0, 0, 0.4);
}

.room-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.devices-grid-floor {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
}

.device-icon-floor {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 8px 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 12px;
}

.device-icon-floor:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.03);
}

.device-icon-floor i {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
}

.status-on {
    background: #7ed957;
    box-shadow: 0 0 8px #7ed957;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(126, 217, 87, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(126, 217, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(126, 217, 87, 0); }
}

.status-off {
    background: #ff6b6b;
}

.bedroom {
    grid-column: 1 / 6;
    grid-row: 1 / 4;
    background: linear-gradient(135deg, rgba(255, 126, 95, 0.25), rgba(254, 180, 123, 0.15));
    border: 2px solid #ff7e5f;
}

.bathroom {
    grid-column: 1 / 3;
    grid-row: 4 / 6;
    background: linear-gradient(135deg, rgba(0, 201, 255, 0.25), rgba(146, 254, 157, 0.15));
    border: 2px solid #00c9ff;
}

.kitchen {
    grid-column: 3 / 6;
    grid-row: 4 / 6;
    background: linear-gradient(135deg, rgba(244, 107, 69, 0.25), rgba(238, 168, 73, 0.15));
    border: 2px solid #f46b45;
}

.living-room {
    grid-column: 1 / 6;
    grid-row: 6 / 10;
    background: linear-gradient(135deg, rgba(131, 77, 155, 0.25), rgba(208, 78, 214, 0.15));
    border: 2px solid #834d9b;
}

.hallway {
    grid-column: 1 / 6;
    grid-row: 10 / 13;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Automation View */
.automation-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.automation-card {
    background: var(--glass);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.automation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.automation-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.automation-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    background: rgba(52, 152, 219, 0.15);
    color: var(--secondary);
}

.automation-title {
    font-size: 18px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.automation-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 14px;
}

.automation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Settings View */
.settings-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.settings-card {
    background: var(--glass);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.settings-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 15px;
    background: rgba(52, 152, 219, 0.15);
    color: var(--secondary);
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 15px;
}

.settings-option:last-child {
    border-bottom: none;
}

.option-label {
    font-size: 16px;
}

/* Device Popup */
.device-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 20px;
}

.device-popup.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: rgba(30, 41, 59, 0.95);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    padding: 25px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(50px);
    transition: transform 0.5s ease;
    position: relative;
}

.device-popup.active .popup-content {
    transform: translateY(0);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.popup-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.popup-icon {
    font-size: 2rem;
    margin-right: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
}

.popup-title {
    font-size: 20px;
    font-weight: 600;
}

.popup-location {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.popup-location i {
    color: var(--accent);
    font-size: 12px;
}

.popup-controls {
    margin-top: 15px;
}

/* Responsive Design - Tablet and Desktop */
@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }
    
    .bottom-nav {
        display: none;
    }
    
    body {
        display: flex;
    }
    
    /* Sidebar Styles */
    .sidebar {
        width: 280px;
        background: rgba(26, 37, 47, 0.95);
        backdrop-filter: blur(10px);
        padding: 30px 0;
        height: 100vh;
        position: fixed;
        z-index: 100;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
    }

    .logo {
        display: flex;
        align-items: center;
        padding: 0 30px 30px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .logo i {
        font-size: 32px;
        color: var(--secondary);
        margin-right: 15px;
        background: rgba(52, 152, 219, 0.15);
        width: 60px;
        height: 60px;
        border-radius: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logo-text h1 {
        font-family: 'Montserrat', sans-serif;
        font-weight: 700;
        font-size: 24px;
        background: linear-gradient(to right, var(--secondary), var(--accent));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .logo-text p {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.6);
        letter-spacing: 1px;
    }

    .nav-links {
        padding: 30px 0;
        flex: 1;
    }

    .nav-item {
        padding: 15px 30px;
        display: flex;
        align-items: center;
        font-size: 18px;
        color: rgba(255, 255, 255, 0.7);
        transition: var(--transition);
        position: relative;
        cursor: pointer;
        flex-direction: row;
        min-width: auto;
        border-radius: 0;
    }

    .nav-item:hover, .nav-item.active {
        color: white;
        background: rgba(52, 152, 219, 0.15);
    }

    .nav-item:hover::before, .nav-item.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 5px;
        background: var(--secondary);
        border-radius: 0 5px 5px 0;
    }

    .nav-item i {
        width: 40px;
        font-size: 20px;
        margin-bottom: 0;
    }

    .status-bar {
        padding: 20px 30px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .status-item {
        display: flex;
        justify-content: space-between;
        margin-bottom: 12px;
        font-size: 14px;
    }

    .status-value {
        font-weight: 600;
    }

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

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

    /* Main Content */
    .main-content {
        flex: 1;
        margin-left: 280px;
        padding: 30px;
        display: flex;
        flex-direction: column;
        padding-bottom: 30px;
    }

    .header {
        margin-bottom: 40px;
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header h2 {
        font-size: 32px;
    }

    .header-controls {
        gap: 20px;
        overflow-x: visible;
        padding-bottom: 0;
    }

    .btn {
        padding: 12px 25px;
        font-size: 16px;
    }

    /* Dashboard View */
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 25px;
        margin-bottom: 40px;
    }

    .stat-card {
        padding: 25px;
        border-radius: 20px;
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
        border-radius: 16px;
    }

    .stat-title {
        font-size: 18px;
    }

    .stat-value {
        font-size: 36px;
    }

    .stat-trend {
        font-size: 14px;
    }

    /* Devices Grid */
    .devices-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 25px;
    }

    .device-card {
        padding: 25px;
        border-radius: 20px;
    }

    .device-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
        border-radius: 16px;
    }

    .device-name {
        font-size: 20px;
    }

    .device-location {
        font-size: 14px;
    }

    /* Floor Plan View */
    .floor-plan-container {
        padding: 30px;
        border-radius: 20px;
        height: 75vh;
    }

    .floor-plan {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(10, 1fr);
        height: 100%;
        gap: 10px;
    }

    .bedroom {
        grid-column: 1 / 6;
        grid-row: 1 / 6;
    }

    .bathroom {
        grid-column: 6 / 8;
        grid-row: 1 / 4;
    }

    .kitchen {
        grid-column: 6 / 8;
        grid-row: 4 / 6;
    }

    .living-room {
        grid-column: 1 / 8;
        grid-row: 6 / 11;
    }

    .hallway {
        grid-column: 8 / 11;
        grid-row: 1 / 11;
    }

    /* Automation View */
    .automation-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .automation-card {
        padding: 30px;
        border-radius: 20px;
    }

    .automation-title {
        font-size: 24px;
    }

    .automation-description {
        font-size: 16px;
    }

    /* Settings View */
    .settings-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .settings-card {
        padding: 30px;
        border-radius: 20px;
    }

    .settings-title {
        font-size: 22px;
    }
}
