@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1a1a1a;
    /* Sinaholz Black */
    --primary-hover: #333333;
    --bg-body: #F9F9F7;
    /* Warm Paper White */
    --bg-sidebar: #ffffff;
    --border: #E5E5E5;
    --text-main: #1a1a1a;
    --danger: #d32f2f;
}

body {
    font-family: 'Poppins', sans-serif;
    height: 100vh;
    margin: 0;
    background: var(--bg-body);
    color: var(--text-main);
    overflow: hidden;
}

/* --- LOGIN SCREEN --- */
/* --- LOGIN SCREEN (Redesign Phase 2 - Monochrome) --- */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    /* Split Layout */
    flex-direction: row;
    z-index: 5000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* LEFT: BRAND PANEL */
.login-brand-panel {
    flex: 1;
    background: #1a1a1a;
    /* Sinaholz Black */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Subtle texture (No gold gradient overlay anymore) */
.login-brand-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.brand-content {
    z-index: 2;
    text-align: center;
}

.login-brand-logo {
    width: 140px;
    /* Slightly larger */
    height: 140px;
    object-fit: contain;
    /* Prevents distortion if PNG is rectangular */
    margin-bottom: 30px;
    /* Keep breathing effect */
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.brand-content h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 4px;
    margin: 0;
    color: white;
    /* Pure White */
}

.brand-content p {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #a3a3a3;
    /* Light Gray (Monochrome Request) */
    font-style: italic;
    margin-top: 10px;
    letter-spacing: 1px;
}

.brand-desc {
    font-family: 'Poppins', sans-serif;
    /* Clean Sans-Serif */
    font-size: 0.85rem;
    color: #666;
    /* Darker Gray */
    margin-top: 15px;
    max-width: 300px;
    line-height: 1.5;
    opacity: 0.8;
}

/* RIGHT: FORM PANEL */
.login-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: white;
    padding: 40px;
}

.form-wrapper {
    width: 100%;
    max-width: 420px;
}

.form-title {
    font-size: 2.2rem;
    font-family: 'Playfair Display', serif;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-weight: 600;
}

.form-subtitle {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 40px;
}

/* Modern Inputs */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    /* Slate 500 */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.modern-input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    color: #1a1a1a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    outline: none;
}

.modern-input:focus {
    background: white;
    border-color: #1a1a1a;
    /* Black Focus (Monochrome Request) */
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Auth Tabs (Redesigned) */
.auth-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

/* Primary Button (Black) */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: #1a1a1a;
    /* Vistara Black */
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    background: #000;
}

.btn-primary:active {
    transform: translateY(0);
}

.forgot-pass {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    text-decoration: underline;
}

/* Responsive: Stack on Mobile */
@media (max-width: 900px) {
    #login-screen {
        flex-direction: column;
    }

    .login-brand-panel {
        flex: 0 0 auto;
        min-height: 300px;
        padding: 40px 20px 40px;
        /* Reduced padding (footer hidden) */
    }

    .login-brand-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 15px;
    }

    .brand-content h1 {
        font-size: 2rem;
    }

    .login-footer-brand {
        display: none;
        /* User Request: Hide on mobile */
    }

    .login-form-panel {
        flex: 1;
        padding: 30px;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        margin-top: -20px;
        /* Overlap */
        z-index: 5;
    }
}

/* FOOTERS */
.login-footer-brand {
    position: absolute;
    bottom: 30px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.login-footer-form {
    margin-top: auto;
    /* Push to bottom if flex container */
    padding-top: 40px;
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    gap: 20px;
}

.footer-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

/* --- APP LAYOUT --- */
#app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* SIDEBAR */
#sidebar {
    width: 300px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid var(--border);
}

/* Brand Row with Icon */
.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.brand {
    font-size: 1.4rem;
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
    color: #1a1a1a;
}

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 5px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.btn-logout svg {
    width: 20px;
    height: 20px;
}

/* Sidebar Controls */
.search-box {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    background: #F9F9F7;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
}

.filter-row {
    display: flex;
    gap: 5px;
}

.filter-select {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    color: #666;
}

.btn-create {
    padding: 8px 15px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#kiosk-list {
    flex: 1;
    overflow-y: auto;
}

.kiosk-item {
    padding: 18px 25px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: 0.2s;
}

.kiosk-item:hover {
    background: #f4f4f4;
}

.kiosk-item.active {
    background: #f0f0f0;
    border-left: 3px solid #1a1a1a;
    /* Changed from Primary/Burgundy logic to explicit Black */
}

.tunnel-badge {
    background: #1a1a1a;
    color: white;
    padding: 2px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 8px;
}

.kiosk-company {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 5px;
}

/* --- EDITOR AREA (Flexbox Fix) --- */
/* --- EDITOR AREA (Flexbox Fix) --- */
#editor-form {
    flex: 1;
    display: none;
    flex-direction: column;
    height: 100%;
    /* Changed from 100vh to fit container */
    background: var(--bg-body);
    overflow: hidden;
}

/* STATE: When Editor is Active */
.kiosk-main.editing #editor-form {
    display: flex !important;
}

.kiosk-main.editing #editor-empty-state {
    display: none !important;
}

/* 1. The Scrollable Content */
/* 1. The Scrollable Content */
.editor-scroll-area {
    flex: 1;
    /* Grow to fill space */
    overflow-y: auto;
    min-height: 0;
    /* Scroll if too long */
    padding: 20px 60px;
    /* Adjusted padding */
}

.editor-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 40px;
}

.editor-title h2 {
    font-size: 2rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.5px;
}

#meta-id {
    font-size: 0.9rem;
    color: #999;
    letter-spacing: 1px;
    font-weight: 500;
}

#meta-cat {
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 5px;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.full-width {
    grid-column: span 2;
}

label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 10px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #dcdcdc;
    background: white;
    font-size: 0.95rem;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    transition: 0.2s;
    border-radius: 4px;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
}

textarea {
    height: 140px;
    resize: vertical;
    line-height: 1.6;
}

/* Banner Preview */
.img-preview-box {
    padding: 20px;
    background: white;
    border: 1px solid #ddd;
    text-align: center;
    margin-top: 10px;
}

#preview-img {
    max-height: 250px;
    max-width: 100%;
    display: none;
    margin: 0 auto;
}

#no-img-text {
    font-size: 0.9rem;
    color: #aaa;
    font-style: italic;
}

/* --- STICKY FOOTER (Flexbox Version) --- */
.action-bar {
    flex-shrink: 0;
    /* Never shrink */
    background: white;
    border-top: 1px solid var(--border);
    padding: 20px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.03);
    z-index: 100;
}

.btn {
    padding: 15px 30px;
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    transition: 0.2s;
}

.btn-save {
    background: var(--primary);
    color: white;
}

.btn-save:hover {
    background: #333;
}

.btn-delete {
    background: transparent;
    color: var(--danger);
}

.btn-delete:hover {
    background: #fff0f0;
}

/* Modals */
#modal-overlay,
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

.modal {
    background: white;
    padding: 40px;
    border: 1px solid #1a1a1a;
    width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- MOBILE RESPONSIVE DRAWER --- */
@media (max-width: 768px) {

    /* 1. Show the Menu Button */
    #mobile-menu-btn {
        display: block !important;
    }

    /* 2. Sidebar becomes a Drawer */
    #sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        /* Hide off-screen */
        width: 85%;
        /* Takes 85% of phone width */
        max-width: 320px;
        height: 100vh;
        z-index: 1100;
        /* On top of everything */
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    /* Class to Open Sidebar */
    #sidebar.open {
        left: 0;
    }

    /* 3. Main Content takes Full Screen */
    #main-content {
        width: 100%;
        padding-top: 60px;
        /* Space for the menu button */
    }

    /* 4. Adjust Stats/Editor Padding */
    #stats-view,
    .editor-scroll-area {
        padding: 20px !important;
        padding-bottom: 100px !important;
    }

    /* 6. Dashboard Safety Distance */
    .app-view {
        padding: 20px !important;
        /* Override 40px default */
        padding-bottom: 100px !important;
        /* Standard Safety Area */
    }

    /* 7. FORCE SPACER DIV */
    .mobile-spacer {
        display: block !important;
        height: 100px !important;
        width: 100%;
        background: transparent;
        /* background: rgba(255,0,0,0.1);  <-- Debug: Tint red to see it */
    }

    /* 5. Mobile Typography Adjustments */
    h1 {
        font-size: 1.8rem !important;
    }

    .stat-card {
        margin-bottom: 15px;
    }

    /* Login Screen Fix */

    /* 8. RECENT ACTIVITY HEADER STACK */
    .recent-activity-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .recent-activity-controls {
        width: 100%;
        justify-content: space-between;
    }

    /* 9. VISITOR ACTIVITY PAGE POLISH */
    .visitor-activity-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .visitor-activity-controls {
        width: 100%;
        justify-content: space-between;
    }

    .log-filter-container {
        padding: 15px !important;
        /* Reduce padding on mobile */
        gap: 15px !important;
    }

    .portal-wrapper {
        padding: 20px !important;
        /* Reset to default temporarily */
    }

    .visitor-stats-grid {
        gap: 15px !important;
        /* Tighter Grid */
    }
}

.mobile-spacer {
    display: none;
    /* Hidden by default on desktop */
}

.activity-timestamp {
    font-size: 0.75rem;
    color: #94a3b8;
    min-width: 80px;
}

/* --- CUSTOM CUBE LOADER --- */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.cube-loader {
    width: 120px;
    height: 120px;
}

/* Inner Cube Styles */
.inner-face {
    fill: #000000;
    stroke: none;
}

/* Outer Cube Styles */
.draw-path {
    stroke: #c7a668;
    stroke-width: 3px;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: draw-cube 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

/* Stagger the drawing of outer faces */
.draw-path:nth-of-type(5) {
    animation-delay: 0.38s;
}

.draw-path:nth-of-type(6) {
    animation-delay: 0.75s;
}

@keyframes draw-cube {
    0% {
        stroke-dasharray: 1;
        stroke-dashoffset: 1;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    50%,
    100% {
        stroke-dasharray: 1;
        stroke-dashoffset: 0;
    }
}