/* ===== RIVERLUX APARTMENTS - ORIGINAL STYLES ===== */

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

:root {
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --border: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --occupied: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-main);
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #e5e7eb;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
    z-index: 1000;
}

/* ===== SIDEBAR INACTIVE MOD ===== */
body.sidebar-inactive .sidebar {
    transform: translateX(-240px);
}

body.sidebar-inactive .main {
    margin-left: 0 !important;
}

body.sidebar-inactive .sidebar:hover,
body.sidebar-inactive .sidebar.open {
    transform: translateX(0);
}

/* Sidebar hover trigger - nevidljiva zona za aktivaciju */
.sidebar-trigger {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 20px;
    height: 100vh;
    z-index: 999;
    background: transparent;
}

body.sidebar-inactive .sidebar-trigger {
    display: block;
}

/* Kućica za povratak na početnu - GLOBALNA (manja, u ćošku) */
.home-button-fixed {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 16px;
    color: white;
    align-items: center;
    justify-content: center;
}

/* Kućica SAMO vidljiva u Sidebar Inactive modu */
body.sidebar-inactive .home-button-fixed {
    display: flex;
}

.home-button-fixed:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.home-button-fixed:active {
    transform: scale(0.95);
}

/* Kontrolna traka za Početnu i Dnevni izveštaj */
.page-controls-bar {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.page-controls-bar .control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-controls-bar .control-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.page-controls-bar .control-btn.home-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

/* Sakrij globalnu kućicu na Početnoj i Dnevni izveštaj - oni imaju svoje */
#view-dashboard .home-button-fixed,
#view-daily .home-button-fixed {
    display: none !important;
}

/* Kućica u kontrolnoj traci - samo vidljiva u Sidebar Inactive modu */
.sidebar-inactive-only {
    display: none !important;
}

body.sidebar-inactive .sidebar-inactive-only {
    display: flex !important;
}

/* VAŽNO: Sakrij globalnu fiksnu kućicu kad smo na Početnoj ili Dnevni izveštaj
   jer one imaju svoje kućice u kontrolnoj traci */
body.sidebar-inactive #view-dashboard.active ~ .home-button-fixed,
body.sidebar-inactive #view-daily.active ~ .home-button-fixed {
    display: none !important;
}

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

.sidebar-logo {
    height: 48px;
    width: auto;
    border-radius: 8px;
    margin-bottom: 8px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.sidebar-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.sidebar-btn {
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    color: #cbd5e1;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.sidebar-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #fff;
}

.sidebar-btn.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-btn .icon {
    font-size: 16px;
}

/* ===== MAIN ===== */
.main {
    margin-left: 240px;
    flex: 1;
    padding: 24px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn {
    background: var(--accent);
    color: #fff;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
}

tr:hover {
    background: #f9fafb;
}

/* ===== CALENDAR ===== */
.calendar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.calendar-grid {
    overflow-x: auto;
}

.calendar-grid table {
    min-width: 100%;
}

.calendar-grid th {
    min-width: 90px;
    text-align: center;
    font-size: 11px;
    padding: 10px 4px;
    background: #f1f5f9;
}

.calendar-grid td {
    min-width: 90px;
    height: 52px;
    text-align: center;
    padding: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
}

.calendar-grid .room-name {
    font-weight: 700;
    background: #f8fafc;
    text-align: left;
    padding-left: 12px;
}

.calendar-grid .weekend {
    background: #fef3c7;
}

.calendar-grid .today {
    background: var(--accent-soft);
}

.cell-empty {
    background: #fff;
    cursor: pointer;
}

.cell-empty:hover {
    background: #dcfce7;
}

.cell-occupied-start,
.cell-occupied-middle,
.cell-occupied-end {
    background: var(--occupied);
    color: #fff;
    cursor: pointer;
}

.cell-occupied-start {
    border-radius: 8px 0 0 8px;
}

.cell-occupied-end {
    border-radius: 0 8px 8px 0;
}

.cell-text {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== ARRIVALS / DEPARTURES ===== */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
}

.ad-column h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.ad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.ad-item.arrival {
    border-left: 3px solid var(--occupied);
}

.ad-item.departure {
    border-left: 3px solid var(--danger);
}

.ad-item.cleaning {
    border-left: 3px solid var(--warning);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== VIEWS ===== */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ===== EXTRA ROOM PILLS ===== */
.extra-room-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin: 2px;
}

.extra-room-pill button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
}

/* ===== SETTINGS ===== */
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.settings-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.settings-tab.active {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-content {
    display: none;
}

.settings-content.active {
    display: block;
}

/* ===== TOOLTIP ===== */
.tooltip {
    position: fixed;
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 2000;
    pointer-events: none;
    max-width: 250px;
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main {
        margin-left: 200px;
    }
    
    .ad-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .sidebar-header {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .sidebar-btn {
        flex: 1 1 45%;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .main {
        margin-left: 0;
        padding: 12px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .calendar-controls {
        justify-content: center;
    }
}

/* ===== HIDE MOBILE ELEMENTS ON DESKTOP ===== */
.header,
.menu-toggle,
.sidebar-overlay,
.sidebar-close {
    display: none !important;
}

/* ===== SIDEBAR SECTION TITLES ===== */
.sidebar-section-title {
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 12px 6px;
    margin-top: 8px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 12px;
}

.sidebar-user {
    margin-top: auto;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

/* ===== KALENDAR DRAG & DROP HANDLES ===== */
td.occupied {
    position: relative;
}

.extend-handle, .shrink-handle {
    position: absolute;
    width: 8px;
    height: 100%;
    top: 0;
    background: rgba(37, 99, 235, 0.3);
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    font-weight: bold;
    user-select: none;
    z-index: 10;
}

.extend-handle {
    right: 0;
    border-left: 2px solid #2563eb;
}

.shrink-handle {
    left: 0;
    border-right: 2px solid #2563eb;
}

td.occupied:hover .extend-handle,
td.occupied:hover .shrink-handle {
    opacity: 1;
}

.extend-handle:hover,
.shrink-handle:hover {
    background: rgba(37, 99, 235, 0.6);
    opacity: 1 !important;
}

.reservation-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    height: 100%;
}

.reservation-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete-reservation {
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.reservation-cell:hover .btn-delete-reservation {
    opacity: 1;
}

.reservation-continuation {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Dragging state */
td.dragging {
    opacity: 0.5;
}

td.drag-over {
    background: rgba(37, 99, 235, 0.2) !important;
}
