/* ==========================================================================
   Bewonersportaal - Custom Styles
   ========================================================================== */

/* CSS Variables */
:root {
    --bp-primary: #0d6efd;
    --bp-primary-dark: #0b5ed7;
    --bp-secondary: #6c757d;
    --bp-success: #198754;
    --bp-warning: #ffc107;
    --bp-danger: #dc3545;
    --bp-info: #0dcaf0;
    --bp-light: #f8f9fa;
    --bp-dark: #212529;
    --bp-sidebar-width: 250px;
    --bp-sidebar-collapsed-width: 70px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--bp-sidebar-width);
    background: linear-gradient(180deg, #1e3a5f 0%, #0d2137 100%);
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--bp-sidebar-collapsed-width);
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo img {
    max-height: 40px;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--bp-primary);
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar.collapsed .sidebar-nav .nav-link span {
    display: none;
}

/* Main content */
.main-content {
    margin-left: var(--bp-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--bp-sidebar-collapsed-width);
}

/* Topbar */
.topbar {
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Content area */
.content-wrapper {
    padding: 1.5rem;
}

/* ==========================================================================
   Components
   ========================================================================== */

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* Stat cards */
.stat-card {
    border-left: 4px solid var(--bp-primary);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--bp-secondary);
    font-size: 0.875rem;
}

/* Tables */
.table > :not(caption) > * > * {
    padding: 0.875rem 1rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Badges */
.badge {
    font-weight: 500;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-primary {
    background-color: var(--bp-primary);
    border-color: var(--bp-primary);
}

.btn-primary:hover {
    background-color: var(--bp-primary-dark);
    border-color: var(--bp-primary-dark);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--bp-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    color: #495057;
}

/* ==========================================================================
   Resident Portal Specific
   ========================================================================== */

/* Welcome card */
.welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 1rem;
    padding: 2rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e9ecef;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--bp-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--bp-primary);
}

.timeline-item.completed::before {
    background-color: var(--bp-success);
    box-shadow: 0 0 0 2px var(--bp-success);
}

.timeline-item.upcoming::before {
    background-color: #fff;
    box-shadow: 0 0 0 2px #adb5bd;
}

/* Photo gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photo-item {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

/* ==========================================================================
   Admin Panel Specific
   ========================================================================== */

/* Quick actions */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.quick-action:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--bp-primary);
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.online { background-color: var(--bp-success); }
.status-dot.offline { background-color: var(--bp-secondary); }
.status-dot.busy { background-color: var(--bp-warning); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Mobile Responsive Utilities
   ========================================================================== */

/* Touch-friendly tap targets */
@media (max-width: 991.98px) {
    .btn {
        min-height: 44px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .btn-sm {
        min-height: 38px;
    }
    
    .nav-link {
        min-height: 44px;
    }
    
    .form-control, .form-select {
        min-height: 44px;
    }
}

/* Responsive helper classes */
@media (max-width: 767.98px) {
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .mobile-stack > * {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    .mobile-stack > *:last-child {
        margin-bottom: 0;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* Table mobile improvements */
@media (max-width: 767.98px) {
    .table-mobile-card tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        padding: 0.75rem;
        background: white;
    }
    
    .table-mobile-card thead {
        display: none;
    }
    
    .table-mobile-card tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #eee;
    }
    
    .table-mobile-card tbody td:last-child {
        border-bottom: none;
    }
    
    .table-mobile-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        margin-right: 1rem;
    }
}

/* Card mobile improvements */
@media (max-width: 575.98px) {
    .card {
        border-radius: 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Form mobile improvements */
@media (max-width: 575.98px) {
    .form-group, .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    label {
        font-size: 0.9rem;
    }
    
    .form-text {
        font-size: 0.8rem;
    }
}

/* Floating action button for mobile */
.fab-mobile {
    display: none;
}

@media (max-width: 575.98px) {
    .fab-mobile {
        display: flex;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--bp-primary, #2563eb);
        color: white;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        z-index: 100;
        text-decoration: none;
    }
    
    .fab-mobile:hover {
        color: white;
        transform: scale(1.05);
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .main-content {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .sidebar {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

/* Print styles */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}
