@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;600;700&display=swap');

:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #4cc9f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray: #64748b;
    --bg-color: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-premium: 0 10px 40px -10px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 50px -10px rgba(0,0,0,0.18);
    --radius-lg: 24px;
    --radius-md: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: radial-gradient(circle at top right, #e2e8f0, #f1f5f9), url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%236366f1' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: 'Outfit', sans-serif;
    padding-bottom: 100px;
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
}

/* ==== GLASSMORPHISM ==== */
.card, .modal-content, .fc, .search-box, .earnings-card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius);
    box-shadow: var(--shadow-premium);
}

/* ==== CALENDAR PREMIUM ==== */
#calendar {
    padding: 20px;
    margin: 20px auto;
    max-width: 1200px;
}
.fc-toolbar-title { font-weight: 800 !important; color: var(--primary); }
.fc-button-primary { 
    background: var(--primary) !important; 
    border: none !important; 
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2) !important;
}
.fc-event, .fc-v-event, .fc-timegrid-event {
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600;
    overflow: visible !important; /* Critical to show rotated text */
}

/* Base style for vertical events in calendar */
.fc-v-event .fc-event-main {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    height: 100%;
    padding: 2px !important;
}

/* Vertical REF ID wrapper - using flex items instead of absolute */
.event-title-wrapper {
    writing-mode: vertical-rl !important;
    text-orientation: mixed !important;
    transform: rotate(180deg) !important;
    white-space: nowrap !important;
    display: flex !important;
    flex-direction: column !important; /* Stack icon and text */
    align-items: center !important;
    justify-content: flex-start !important; /* Start from the top of the stripe */
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border-radius: 4px;
    padding: 10px 2px !important; /* Slightly more padding for icons */
    margin-right: 4px !important;
    flex-shrink: 0 !important;
    min-width: 22px !important; /* Slightly wider for icons */
}

@media (max-width: 600px) {
    .event-title-wrapper {
        font-size: 11px !important;
        min-width: 20px !important;
        padding: 5px 2px !important;
    }
}

/* Smart Filter - hide non-matching tasks */
.filtered-out {
    display: none !important;
}

/* Dropdown style matching FullCalendar buttons */
.filter-select {
    border: 1px solid var(--glass-border) !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    padding: 6px 12px 6px 36px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%236366f1' d='M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z'/%3E%3C/svg%3E") !important;
    background-size: 16px !important;
    background-position: 10px center !important;
    background-repeat: no-repeat !important;
    color: var(--primary) !important;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.filter-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25) !important;
}

/* ==== BUTTONS ==== */
.btn {
    border-radius: 14px;
    font-weight: 700;
    padding: 14px 24px;
    transition: var(--transition);
    border: none;
}
.btn-primary { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -6px rgba(99, 102, 241, 0.5); }

.btn-info {
    background: linear-gradient(135deg, #0dcaf0, #0aa2c0);
    color: white !important;
    box-shadow: 0 8px 20px -6px rgba(13, 202, 240, 0.4);
}
.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -6px rgba(13, 202, 240, 0.5);
    background: linear-gradient(135deg, #31d2f2, #0dcaf0);
}

/* ==== NAVIGATION ==== */
.nav-bar-bottom {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    height: 75px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}
.nav-item {
    text-decoration: none;
    color: var(--gray);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
}
.nav-item i { font-size: 1.4rem; margin-bottom: 4px; }
.nav-item.active { color: var(--primary); transform: translateY(-5px); }
.nav-item.active i { filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3)); }

/* ==== FAB ==== */
.fab-btn {
    position: fixed;
    right: 25px;
    bottom: 100px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    font-size: 30px;
    border: none;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    z-index: 999;
}

/* ==== FINANCIAL CARDS ==== */
.earnings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}
.finance-stat {
    padding: 20px;
}
.stat-value { font-size: 1.8rem; font-weight: 800; display: block; line-height: 1.2; }
.stat-label { color: var(--gray); font-weight: 700; text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.5px; }

/* Mobile refinement for stats */
@media (max-width: 400px) {
    .stat-value { font-size: 1.4rem !important; }
}

/* ==== MODALS MOBILE FIX ==== */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}
@media (max-width: 576px) {
    .modal-content {
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }
    .modal-body {
        overflow-y: auto;
        flex: 1;
    }
    .modal-footer {
        flex-shrink: 0;
    }
    .modal-dialog {
        margin: 0.5rem;
        display: flex;
        align-items: flex-end; /* Align to bottom for easier thumb reach */
    }
}

body.map-page {
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
}

/* ==== MAP PREMIUM ==== */
.header-map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    padding: 10px 15px;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    z-index: 1000;
}

#map {
    position: absolute;
    top: 100px; /* Header height */
    bottom: 75px; /* Footer height */
    left: 0;
    right: 0;
    z-index: 1;
}

.nav-btn {
    display: inline-block;
    padding: 8px 12px;
    background: var(--primary);
    color: white !important;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.75rem;
    margin-top: 5px;
    transition: var(--transition);
}
.nav-btn:hover { transform: scale(1.05); }

/* ==== BAZA / APARTMENTS LIST ==== */
.search-container {
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
}
/* ==== PREMIUM COLOR THEMES (Vibrant Phase) ==== */
.theme-apartment { 
    --theme-primary: #4361ee; 
    --theme-grad: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    --theme-light: rgba(67, 97, 238, 0.1);
}
.theme-duplex { 
    --theme-primary: #7209b7; 
    --theme-grad: linear-gradient(135deg, #7209b7 0%, #560bad 100%);
    --theme-light: rgba(114, 9, 183, 0.1);
}
.theme-villa { 
    --theme-primary: #f59e0b; 
    --theme-grad: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --theme-light: rgba(245, 158, 11, 0.1);
}

.apt-card-premium {
    background: white !important;
    border-radius: 30px;
    box-shadow: 0 15px 45px -10px rgba(0,0,0,0.12);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none !important;
    overflow: hidden;
    height: 100%;
}
.apt-card-premium:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.2);
}

.apt-media-header {
    height: 160px; /* Increased for impact */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-grad); /* Vibrant Gradient */
}

.icon-glass-wrap {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white; /* Contrast! */
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 2;
}

.icon-glass-wrap i { font-size: 3.5rem !important; }

.apt-compact-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.apt-ref-title {
    font-size: 1.6rem;
    font-weight: 850;
    color: #1e293b;
    margin-bottom: 2px;
}

.apt-compact-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.apt-ref-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

.info-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: #f8fafc;
    border-radius: 16px;
    font-size: 0.9rem;
    border: 1px solid rgba(0,0,0,0.03);
}

.info-strip i { color: var(--theme-primary); font-size: 1.1rem; }
.info-strip .value { color: #0f172a; font-weight: 800; }

.notes-compact {
    padding: 14px;
    background: var(--theme-light);
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--theme-primary);
    border-left: 5px solid var(--theme-primary);
    font-weight: 500;
}

.btn-premium-group {
    display: flex;
    gap: 12px;
    padding: 0 24px 24px;
}

.btn-map-premium {
    background: var(--theme-grad) !important;
    color: white !important;
    border: none !important;
    font-weight: 800 !important;
    box-shadow: 0 8px 25px -5px var(--theme-primary);
}

.btn-view-premium {
    border: 2px solid var(--theme-primary) !important;
    color: var(--theme-primary) !important;
    background: white !important;
    font-weight: 800 !important;
}

/* ==== UTILITIES ==== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==== PWA PUSH BANNER ==== */
.push-banner {
    background: var(--dark);
    color: white;
    padding: 15px 20px;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 2000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-bottom: 2px solid var(--primary);
}
.push-banner button {
    padding: 6px 15px !important;
    font-size: 0.75rem !important;
}
