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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
}


body.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 50%, #DBEAFE 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.login-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 1024px) {
    .login-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.login-form-wrapper {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6b7280;
    margin-bottom: 2rem;
}

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

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #aacfd2;
    box-shadow: 0 0 0 3px #a9dadd;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #6FB3B8 0%, #6FB3B8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px #c8f3f7;
    transition: all 0.3s ease;
}

.btn-login:hover {
    background: linear-gradient(135deg, #5fadb3 0%, #5fadb3 100%);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px #aef1f7;
}

.illustration-wrapper {
    display: none;
}

@media (min-width: 1024px) {
    .illustration-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.illustration-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.dashboard-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #EFF6FF 0%, #F9FAFB 50%, #DBEAFE 100%);
}

.navbar {
    background: #388087;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
     padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f6f6f2;
}

.mqtt-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f6f6f2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.mqtt-status span {
    font-size: 0.875rem;
    font-weight: 600;
    color: #f6f6f2;
}

.dashboard-container {
    padding: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr 400px;
    }
}

.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    border: 1px solid #f3f4f6;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    color: #3b82f6;
}

.occupancy-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .occupancy-content {
        flex-direction: row;
        align-items: center;
    }
}

.chart-wrapper {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
}

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

.stat-card {
    border-radius: 12px;
    padding: 1rem;
    border: 2px solid;
}

.stat-occupied {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border-color: #FECACA;
}

.stat-available {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-color: #BBF7D0;
}

.stat-percentage {
    background: linear-gradient(135deg, #EFF6FF 0%, #BADFE7 100%);
    border-color: #BADFE7;
    grid-column: 1 / -1;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-occupied .stat-label {
    color: #DC2626;
}

.stat-available .stat-label {
    color: #059669;
}

.stat-percentage .stat-label {
    color: #2563EB;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
}

.stat-occupied .stat-value {
    color: #B91C1C;
}

.stat-available .stat-value {
    color: #047857;
}

.stat-percentage .stat-value {
    color: #1D4ED8;
}

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

.slot {
    border-radius: 12px;
    padding: 3.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
    border: 2px solid;
    transition: transform 0.2s ease;
    height: 135px;
    width: 135px;
}

.slot:hover {
    transform: translateY(-2px);
}

.slot.available {
    background: #D1FAE5;
    color: #065F46;
    border-color: #6EE7B7;
}

.slot.occupied {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
}

.environment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .environment-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.full-width {
    grid-column: 1 / -1; 
}

.env-card {
    padding: 1.5rem;
    height: 200px;
    min-height: 150px;
}

.env-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.env-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.env-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.status-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 12px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-label svg {
    color: #6b7280;
}

.control-label span {
    font-weight: 500;
    color: #374151;
}

.btn-toggle {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #d1d5db;
    color: #374151;
}

.btn-toggle.active {
    background: #3b82f6;
    color: white;
}

.btn-toggle.gate-open {
    background: #10b981;
    color: white;
}

.btn-toggle.lamp-on {
    background: #eab308;
    color: white;
}

.btn-toggle.buzzer-active {
    background: #f97316;
    color: white;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}

.status-normal {
    background: #D1FAE5;
    color: #065F46;
}

.status-detected {
    background: #FEE2E2;
    color: #991B1B;
}

.gate-control {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    border-radius: 12px;
    padding: 1rem;
    border: 2px solid;
}

.info-broker {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-color: #BFDBFE;
}

.info-latency {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-color: #BBF7D0;
}

.info-alert {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-color: #FDE68A;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.info-broker .info-label {
    color: #2563EB;
}

.info-latency .info-label {
    color: #059669;
}

.info-alert .info-label {
    color: #D97706;
}

.info-value {
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #1E40AF;
}

.info-value-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: #047857;
}

.alert-content {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-content svg {
    color: #D97706;
    margin-top: 0.125rem;
}

.alert-message {
    font-size: 0.875rem;
    color: #92400E;
}

.btn-refresh {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

@media (max-width: 768px) {
    .navbar h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem;
    }

    .login-form-wrapper {
        padding: 2rem;
    }
}

.env-card canvas {
    width: 100% !important;
    height: 80px !important;
}

.fire-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.fire-box {
    background: #dc2626;
    color: white;
    padding: 150px;
    border-radius: 16px;
    text-align: center;
    width: 1000px;
    height: 500px;
    animation: pop 0.3s ease;
}

.fire-box h1 {
    font-size: 60px;
    font-weight: 1000;
}

.fire-box p {
    font-size: 25px;
}

.fire-box button {
    margin-top: 15px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

@keyframes pop {
    from {transform: scale(0.8); opacity:0;}
    to {transform: scale(1); opacity:1;}
}

.bar {
    width: 100%;
    height: 12px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

#distanceBar {
    height: 100%;
    width: 0%;
    background: #10b981;
    transition: 0.3s;
}

#distanceText {
    font-weight: bold;
}

#distanceStatus {
    font-size: 14px;
}

.environment-grid.full-width {
    grid-column: 1 / -1;
    margin-top: -224px;
    width: 1200px;
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 768px) {

    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .left-column,
    .right-column {
        gap: 1rem;
    }

    .card {
        width: 100%;
        overflow: hidden;
    }

    .occupancy-content {
        flex-direction: column;
        align-items: center;
    }

    .chart-wrapper {
        max-width: 180px;
    }

    .occupancy-stats {
        width: 100%;
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 0.8rem;
    }

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

    .slots-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        justify-items: center;
    }

    .slot {
        width: 100%;
        max-width: 120px;
        height: 120px;
        padding: 2.5rem;
        font-size: 1rem;
    }

    .control-item {
        gap: 0.7rem;
        align-items: center;
    }

    .control-label span {
        font-size: 0.95rem;
    }

    .btn-toggle,
    .status-badge {
        font-size: 0.8rem;
        padding: 0.45rem 0.8rem;
    }

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

    .environment-grid.full-width {
        width: 100%;
        margin-top: 0;
        grid-template-columns: 1fr;
    }

    .env-card {
        height: auto;
        min-height: 160px;
    }

    .fire-box {
        width: 90%;
        height: auto;
        padding: 2rem;
    }

    .fire-box h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .fire-box p {
        font-size: 1rem;
    }

    .navbar-content {
        align-items: flex-start;
    }

    .mqtt-status {
        font-size: 0.8rem;
    }

    .btn-refresh {
        font-size: 0.9rem;
    }
}

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

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

.nav-dropdown {
    position: relative;
}

.dropdown-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 12px;

    display: flex;
    align-items: center;
    gap: 0.5rem;

    cursor: pointer;
    transition: 0.3s;
}

.dropdown-btn:hover {
    background: rgba(255,255,255,0.22);
}

.dropdown-menu {
    position: absolute;
    top: 120%;
    left: 0;

    background: white;
    min-width: 180px;

    border-radius: 14px;
    overflow: hidden;

    box-shadow: 0 10px 30px rgba(0,0,0,0.12);

    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);

    transition: 0.25s;
    z-index: 999;
}

.dropdown-menu a {
    display: block;
    padding: 0.9rem 1rem;

    text-decoration: none;
    color: #1f2937;

    font-weight: 500;
    transition: 0.2s;
}

.dropdown-menu a:hover {
    background: #f3f4f6;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.history-table th {
    background: #388087;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

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

.pagination {
    margin-top: 2rem;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.7rem;

    flex-wrap: wrap;
}

.page-btn {
    border: none;
    background: white;

    min-width: 42px;
    height: 42px;

    padding: 0 1rem;

    border-radius: 12px;

    font-weight: 500;
    color: #374151;

    cursor: pointer;

    box-shadow: 0 4px 14px rgba(0,0,0,0.05);

    transition: 0.25s;
}

.page-btn:hover {
    transform: translateY(-2px);
    background: #f3f4f6;
}

.page-btn.active {
    background: #388087;
    color: white;

    box-shadow:
        0 10px 20px rgba(56,128,135,0.25);
}

.table-wrapper{
    width:100%;
    overflow-x:auto;
}

.history-table{
    width:100%;
    min-width:700px;
    border-collapse:collapse;
}

.history-table th,
.history-table td{
    padding:14px;
    text-align:left;
}

@media (max-width:768px){

    .history-table{
        min-width:600px;
    }

    .pagination{
        flex-wrap:wrap;
        gap:0.5rem;
    }

    .page-btn{
        padding:0.6rem 0.9rem;
        font-size:0.85rem;
    }
}