:root {

    --primary: #6366f1;

    --primary-dark: #4f46e5;

    --primary-light: #818cf8;

    --secondary: #22d3ee;

    --success: #10b981;

    --warning: #f59e0b;

    --danger: #ef4444;

    --bg-dark: #0f0f23;

    --bg-card: rgba(30, 30, 60, 0.6);

    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;

    --text-secondary: #a0a0b0;

    --border-color: rgba(255, 255, 255, 0.1);

    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

}



* {

    margin: 0;

    padding: 0;

    box-sizing: border-box;

}



body {

    font-family: 'Inter', 'Segoe UI', sans-serif;

    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);

    min-height: 100vh;

    color: var(--text-primary);

    overflow-x: hidden;

}



body::before {

    content: '';

    position: fixed;

    top: 0;

    left: 0;

    right: 0;

    bottom: 0;

    background:

        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),

        radial-gradient(circle at 80% 20%, rgba(34, 211, 238, 0.1) 0%, transparent 50%),

        radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 60%);

    pointer-events: none;

    z-index: -1;

    animation: bgPulse 8s ease-in-out infinite;

}



@keyframes bgPulse {



    0%,

    100% {

        opacity: 1;

    }



    50% {

        opacity: 0.7;

    }

}



.login-container {

    display: flex;

    justify-content: center;

    align-items: center;

    min-height: 100vh;

    padding: 20px;

}



.login-box {

    background: var(--bg-card);

    backdrop-filter: blur(20px);

    border: 1px solid var(--border-color);

    border-radius: 24px;

    padding: 48px;

    width: 100%;

    max-width: 420px;

    box-shadow: var(--shadow-glow);

    animation: slideUp 0.6s ease-out;

}



@keyframes slideUp {

    from {

        opacity: 0;

        transform: translateY(40px);

    }



    to {

        opacity: 1;

        transform: translateY(0);

    }

}



.login-header {

    text-align: center;

    margin-bottom: 36px;

}



.login-icon {

    width: 80px;

    height: 80px;

    background: linear-gradient(135deg, var(--primary), var(--secondary));

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    margin: 0 auto 20px;

    font-size: 36px;

    animation: iconFloat 3s ease-in-out infinite;

}



@keyframes iconFloat {



    0%,

    100% {

        transform: translateY(0);

    }



    50% {

        transform: translateY(-8px);

    }

}



.login-header h1 {

    font-size: 28px;

    font-weight: 700;

    margin-bottom: 8px;

    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));

    -webkit-background-clip: text;

    -webkit-text-fill-color: transparent;

    background-clip: text;

}



.login-header p {

    color: var(--text-secondary);

    font-size: 14px;

}



.form-group {

    margin-bottom: 24px;

    position: relative;

}



.form-group label {

    display: block;

    margin-bottom: 8px;

    font-size: 14px;

    font-weight: 500;

    color: var(--text-secondary);

}



.form-group input {

    width: 100%;

    padding: 14px 18px;

    background: var(--bg-glass);

    border: 1px solid var(--border-color);

    border-radius: 12px;

    color: var(--text-primary);

    font-size: 16px;

    transition: var(--transition);

    outline: none;

}



.form-group input:focus {

    border-color: var(--primary);

    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);

}



.form-group input::placeholder {

    color: var(--text-secondary);

    opacity: 0.6;

}



.login-error {

    background: rgba(239, 68, 68, 0.1);

    border: 1px solid rgba(239, 68, 68, 0.3);

    border-radius: 8px;

    padding: 12px;

    margin-bottom: 20px;

    color: var(--danger);

    font-size: 14px;

    text-align: center;

    display: none;

    animation: shake 0.5s ease-in-out;

}



@keyframes shake {



    0%,

    100% {

        transform: translateX(0);

    }



    25% {

        transform: translateX(-8px);

    }



    75% {

        transform: translateX(8px);

    }

}



.btn {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    padding: 14px 28px;

    border: none;

    border-radius: 12px;

    font-size: 16px;

    font-weight: 600;

    cursor: pointer;

    transition: var(--transition);

    position: relative;

    overflow: hidden;

}



.btn::before {

    content: '';

    position: absolute;

    top: 0;

    left: -100%;

    width: 100%;

    height: 100%;

    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);

    transition: 0.5s;

}



.btn:hover::before {

    left: 100%;

}



.btn-primary {

    width: 100%;

    background: linear-gradient(135deg, var(--primary), var(--primary-dark));

    color: white;

    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);

}



.btn-primary:hover {

    transform: translateY(-2px);

    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);

}



.btn-primary:active {

    transform: translateY(0);

}



.dashboard {

    display: none;

    min-height: 100vh;

    padding: 20px;

}



.dashboard.active {

    display: block;

    animation: fadeIn 0.5s ease-out;

}



@keyframes fadeIn {

    from {

        opacity: 0;

    }



    to {

        opacity: 1;

    }

}



.header {

    background: var(--bg-card);

    backdrop-filter: blur(20px);

    border: 1px solid var(--border-color);

    border-radius: 20px;

    padding: 20px 30px;

    margin-bottom: 24px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    flex-wrap: wrap;

    gap: 16px;

}



.header-left {

    display: flex;

    align-items: center;

    gap: 16px;

}



.logo {

    width: 48px;

    height: 48px;

    background: linear-gradient(135deg, var(--primary), var(--secondary));

    border-radius: 12px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 24px;

}



.header-title h1 {

    font-size: 22px;

    font-weight: 700;

}



.header-title p {

    color: var(--text-secondary);

    font-size: 13px;

}



.header-right {

    display: flex;

    align-items: center;

    gap: 24px;

}



.realtime-clock {

    text-align: right;

}



.clock-time {

    font-size: 28px;

    font-weight: 700;

    font-feature-settings: "tnum";

    background: linear-gradient(135deg, var(--secondary), var(--primary-light));

    -webkit-background-clip: text;

    -webkit-text-fill-color: transparent;

    background-clip: text;

}



.clock-date {

    color: var(--text-secondary);

    font-size: 13px;

}



.user-menu {

    display: flex;

    align-items: center;

    gap: 12px;

}



.user-avatar {

    width: 44px;

    height: 44px;

    background: linear-gradient(135deg, var(--success), var(--secondary));

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 600;

    font-size: 18px;

}



.btn-logout {

    background: rgba(239, 68, 68, 0.1);

    border: 1px solid rgba(239, 68, 68, 0.3);

    color: var(--danger);

    padding: 10px 18px;

    font-size: 14px;

}



.btn-logout:hover {

    background: rgba(239, 68, 68, 0.2);

    border-color: var(--danger);

}



.status-grid {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));

    gap: 20px;

    margin-bottom: 24px;

}



.status-card {

    background: var(--bg-card);

    backdrop-filter: blur(20px);

    border: 1px solid var(--border-color);

    border-radius: 20px;

    padding: 24px;

    position: relative;

    overflow: hidden;

    transition: var(--transition);

}



.status-card:hover {

    transform: translateY(-4px);

    box-shadow: var(--shadow-glow);

}



.status-card::before {

    content: '';

    position: absolute;

    top: 0;

    left: 0;

    right: 0;

    height: 3px;

    background: linear-gradient(90deg, var(--primary), var(--secondary));

}



.status-card-header {

    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    margin-bottom: 16px;

}



.status-card-icon {

    width: 50px;

    height: 50px;

    border-radius: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 24px;

}



.status-card-icon.mqtt {

    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(34, 211, 238, 0.2));

}



.status-card-icon.device {

    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(34, 211, 238, 0.2));

}



.status-card-icon.door {

    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));

}



.status-badge {

    padding: 6px 14px;

    border-radius: 20px;

    font-size: 12px;

    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: 0.5px;

}



.status-badge.connected {

    background: rgba(16, 185, 129, 0.15);

    color: var(--success);

    animation: pulse 2s infinite;

}



.status-badge.disconnected {

    background: rgba(239, 68, 68, 0.15);

    color: var(--danger);

}



.status-badge.locked {

    background: rgba(16, 185, 129, 0.15);

    color: var(--success);

}



.status-badge.unlocked {

    background: rgba(245, 158, 11, 0.15);

    color: var(--warning);

}



@keyframes pulse {



    0%,

    100% {

        opacity: 1;

    }



    50% {

        opacity: 0.6;

    }

}



.status-card h3 {

    font-size: 14px;

    color: var(--text-secondary);

    font-weight: 500;

    margin-bottom: 4px;

}



.status-card .status-value {

    font-size: 24px;

    font-weight: 700;

}



.main-grid {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 24px;

}



@media (max-width: 1024px) {

    .main-grid {

        grid-template-columns: 1fr;

    }

}



.panel {

    background: var(--bg-card);

    backdrop-filter: blur(20px);

    border: 1px solid var(--border-color);

    border-radius: 20px;

    overflow: hidden;

}



.panel-header {

    padding: 14px 16px;

    border-bottom: 1px solid var(--border-color);

    display: flex;

    justify-content: space-between;

    align-items: center;

}



.panel-header h2 {

    font-size: 18px;

    font-weight: 600;

    display: flex;

    align-items: center;

    gap: 10px;

}



.panel-body {

    padding: 16px;

}



.control-grid {

    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 16px;

}



.control-btn {

    background: var(--bg-glass);

    border: 1px solid var(--border-color);

    border-radius: 16px;

    padding: 24px;

    text-align: center;

    cursor: pointer;

    transition: var(--transition);

    position: relative;

    overflow: hidden;

}



.control-btn:hover {

    border-color: var(--primary);

    transform: translateY(-2px);

}



.control-btn:active {

    transform: scale(0.98);

}



.control-btn.sending {

    pointer-events: none;

}



.control-btn.sending::after {

    content: '';

    position: absolute;

    inset: 0;

    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);

    animation: shimmer 1s infinite;

}



@keyframes shimmer {

    0% {

        transform: translateX(-100%);

    }



    100% {

        transform: translateX(100%);

    }

}



.control-btn-icon {

    width: 56px;

    height: 56px;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 28px;

    margin: 0 auto 12px;

    transition: var(--transition);

}



.control-btn:hover .control-btn-icon {

    transform: scale(1.1);

}



.control-btn.unlock .control-btn-icon {

    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));

}



.control-btn.lock .control-btn-icon {

    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));

}



.control-btn.ping .control-btn-icon {

    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));

}



.control-btn.buzz .control-btn-icon {

    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));

}



.control-btn h3 {

    font-size: 16px;

    font-weight: 600;

    margin-bottom: 4px;

}



.control-btn p {

    font-size: 12px;

    color: var(--text-secondary);

}



.log-stream {

    height: 450px;

    overflow-y: auto;

    background: transparent;

    border-radius: 0;

    padding: 8px;

}



.log-stream::-webkit-scrollbar {

    width: 5px;

}



.log-stream::-webkit-scrollbar-track {

    background: transparent;

}



.log-stream::-webkit-scrollbar-thumb {

    background: var(--border-color);

    border-radius: 3px;

}



.log-stream::-webkit-scrollbar-thumb:hover {

    background: var(--primary);

}



.log-entry {

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 10px 12px;

    margin-bottom: 6px;

    border-radius: 10px;

    background: linear-gradient(135deg, rgba(30, 30, 60, 0.9), rgba(20, 20, 40, 0.7));

    border: 1px solid rgba(255, 255, 255, 0.05);

    animation: logSlide 0.3s ease-out;

    transition: var(--transition);

}



.log-entry:last-child {

    margin-bottom: 0;

}



.log-entry:hover {

    background: linear-gradient(135deg, rgba(40, 40, 80, 0.9), rgba(30, 30, 60, 0.7));

    border-color: rgba(255, 255, 255, 0.1);

    transform: translateX(3px);

}



@keyframes logSlide {

    from {

        opacity: 0;

        transform: translateY(-8px);

    }



    to {

        opacity: 1;

        transform: translateY(0);

    }

}



.log-entry.send {

    border-left: 3px solid var(--secondary);

}



.log-entry.error {

    border-left: 3px solid var(--danger);

    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(20, 20, 40, 0.7));

}



.log-entry.system {

    border-left: 3px solid var(--success);

}



.log-entry.receive {

    border-left: 3px solid var(--primary);

}



.log-icon {

    width: 36px;

    height: 36px;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.05);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 18px;

    flex-shrink: 0;

}



.log-content {

    flex: 1;

    min-width: 0;

}



.log-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 2px;

}



.log-title {

    font-size: 13px;

    font-weight: 600;

    color: var(--text-primary);

}



.log-time {

    font-size: 11px;

    color: var(--text-secondary);

    opacity: 0.7;

    white-space: nowrap;

}



.log-desc {

    font-size: 12px;

    color: var(--text-secondary);

    line-height: 1.3;

}



.history-tabs {

    display: flex;

    gap: 8px;

}



.history-tab {

    padding: 8px 16px;

    background: var(--bg-glass);

    border: 1px solid var(--border-color);

    border-radius: 8px;

    color: var(--text-secondary);

    font-size: 13px;

    cursor: pointer;

    transition: var(--transition);

}



.history-tab:hover,

.history-tab.active {

    background: var(--primary);

    border-color: var(--primary);

    color: white;

}



.history-list {

    height: 350px;

    overflow-y: auto;

}



.history-item {

    display: flex;

    align-items: center;

    gap: 16px;

    padding: 16px;

    border-bottom: 1px solid var(--border-color);

    transition: var(--transition);

}



.history-item:hover {

    background: var(--bg-glass);

}



.history-icon {

    width: 44px;

    height: 44px;

    border-radius: 12px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 20px;

    flex-shrink: 0;

}



.history-icon.unlock {

    background: rgba(16, 185, 129, 0.15);

}



.history-icon.lock {

    background: rgba(239, 68, 68, 0.15);

}



.history-icon.rfid {

    background: rgba(99, 102, 241, 0.15);

}



.history-content {

    flex: 1;

}



.history-title {

    font-weight: 600;

    margin-bottom: 4px;

}



.history-desc {

    font-size: 13px;

    color: var(--text-secondary);

}



.history-time {

    font-size: 12px;

    color: var(--text-secondary);

    text-align: right;

}



.btn-clear {

    background: transparent;

    border: 1px solid var(--border-color);

    color: var(--text-secondary);

    padding: 8px 16px;

    font-size: 13px;

}



.btn-clear:hover {

    border-color: var(--danger);

    color: var(--danger);

}



.toast-container {

    position: fixed;

    top: 24px;

    right: 24px;

    z-index: 1000;

    display: flex;

    flex-direction: column;

    gap: 12px;

}



.toast {

    background: var(--bg-card);

    backdrop-filter: blur(20px);

    border: 1px solid var(--border-color);

    border-radius: 12px;

    padding: 16px 20px;

    min-width: 300px;

    display: flex;

    align-items: center;

    gap: 12px;

    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);

    animation: toastSlide 0.4s ease-out;

}



@keyframes toastSlide {

    from {

        opacity: 0;

        transform: translateX(100px);

    }



    to {

        opacity: 1;

        transform: translateX(0);

    }

}



.toast.success {

    border-left: 4px solid var(--success);

}



.toast.error {

    border-left: 4px solid var(--danger);

}



.toast.info {

    border-left: 4px solid var(--primary);

}



.toast-icon {

    font-size: 24px;

}



.toast-content h4 {

    font-size: 14px;

    font-weight: 600;

    margin-bottom: 2px;

}



.toast-content p {

    font-size: 13px;

    color: var(--text-secondary);

}



@media (max-width: 768px) {

    .header {

        padding: 16px 20px;

    }



    .header-right {

        flex-direction: column;

        align-items: flex-start;

        gap: 16px;

        width: 100%;

    }



    .realtime-clock {

        text-align: left;

    }



    .control-grid {

        grid-template-columns: 1fr;

    }



    .login-box {

        padding: 32px 24px;

    }

}



.spinner {

    width: 20px;

    height: 20px;

    border: 2px solid transparent;

    border-top-color: currentColor;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;

}



@keyframes spin {

    to {

        transform: rotate(360deg);

    }

}



.empty-state {

    text-align: center;

    padding: 48px 24px;

    color: var(--text-secondary);

}



.empty-state-icon {

    font-size: 48px;

    margin-bottom: 16px;

    opacity: 0.5;

}



.empty-state h3 {

    font-size: 18px;

    margin-bottom: 8px;

    color: var(--text-primary);

}



.empty-state p {

    font-size: 14px;

}
