@import url('theme.css');

html, body {
    width: 100%;
}

/* Header */
#page-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.4rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin: 0;
}

#brand h2 {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    margin: 0;
}

/* Navigation */
.nav-menu ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.nav-menu a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.3rem;
}

.nav-menu a:hover {
    color: var(--accent-primary);
}

/* Hero / Top Section */
#welcome-banner {
    background: linear-gradient(to right, #1e293b, #0f172a);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

#welcome-banner h3 {
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

/* Sidebar Utilities */
.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.sidebar-links {
    list-style: none;
}

.sidebar-links li {
    margin-bottom: 0.75rem;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.sidebar-links a:hover {
    color: var(--accent-primary);
    transform: translateX(4px);
    transition: transform 0.2s;
}

/* Calendar Styles - Modernized */
#calendar-widget {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

#calendar-widget table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
}

#calendar-widget th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 0;
}

#calendar-widget td {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    text-align: center;
    padding: 0;
    width: 14.28%; /* 7 columns */
    height: 40px;
    vertical-align: middle;
    font-size: 0.9rem;
    transition: all 0.2s;
}

#calendar-widget td a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
}

#calendar-widget td:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Today Highlight */
#calendar-widget td.today {
    background: var(--accent-primary);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Event Highlight */
#calendar-widget td.has-event {
    border: 1px solid var(--accent-secondary);
    position: relative;
}

#calendar-widget td.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent-secondary);
}

/* Event Blink Animation (Replacement for <blink>) */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(234, 179, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

.blink-event {
    animation: pulse-glow 2s infinite;
    color: var(--warning-color) !important;
    font-weight: bold;
}

/* Forms */
.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input[type="text"] {
    flex: 1;
}

/* Alert/Message Boxes */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

/* Footer */
#page-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

/* --- Responsive & Modern Additions --- */

/* Responsive Grid Layout */
.layout-grid {
    display: grid;
    grid-template-columns: 180px 1fr 300px;
    gap: 20px;
}

@media (max-width: 992px) {
    .layout-grid {
        grid-template-columns: 160px 1fr;
    }
    .layout-grid > aside:last-child {
        grid-column: 1 / -1; /* Bottom sidebar full width */
        order: 3;
    }
}

/* New Mobile Toggle Button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .layout-grid {
        display: flex;
        flex-direction: column;
    }
    
    /* Reorder for Mobile: Main Content First */
    .layout-grid > main {
        order: 1;
    }
    .layout-grid > aside {
        order: 2;
    }
    
    /* Header Adjustments */
    #header-content {
        flex-wrap: wrap;
    }
    
    .nav-toggle {
        display: block !important;
    }
    
    .nav-menu {
        width: 100%;
        display: none;
        flex-direction: column;
        padding-top: 10px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu ul {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-menu a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    /* Dropdown on Mobile */
    .dropdown:hover .dropdown-content {
        display: none; /* Disable hover on mobile */
    }
    .dropdown.active .dropdown-content {
        display: block;
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,0.2);
        margin-top: 5px;
        padding-left: 15px;
    }
    
    #welcome-banner {
        padding: 1.5rem;
    }
    
    /* Dashboard Grid Mobile */
    .card .grid {
        grid-template-columns: 1fr !important; /* Stack dashboard items */
    }
}

/* New Mobile Toggle Button */

/* Modern Card Touch-ups */
.card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Button & Input Touch Targets */
button, input, select, textarea, a.btn {
    min-height: 44px; /* Accessible touch target */
}

/* Utility for Flex ordering */
.order-1 { order: 1; }
.order-2 { order: 2; }
.order-3 { order: 3; }

/* Responsive Grid System (Simplified) */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.g-0 {
    margin-right: 0;
    margin-left: 0;
}
.row > [class*="col-"] {
    padding-right: 15px;
    padding-left: 15px;
    width: 100%; /* Default to full width for mobile */
}
.g-0 > [class*="col-"] {
    padding-right: 0;
    padding-left: 0;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .order-md-1 { order: 1; }
    .order-md-2 { order: 2; }
}

.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); }
.border-0 { border: 0 !important; }
.h-100 { height: 100% !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-lg-5 { padding: 3rem !important; }
.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.fw-bold { font-weight: 700 !important; }
.lead { font-size: 1.25rem; font-weight: 300; }
.rounded-pill { border-radius: 50rem !important; }
.btn-lg { padding: 0.5rem 1rem; font-size: 1.25rem; }




/* Global Select Option Styling to match Theme */
select option {
    background-color: var(--card-bg);
    color: var(--text-main);
    padding: 10px;
}

/* --- Events Page Styles (Moved from events.php) --- */
.evt-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.evt-item { 
    display: grid; 
    grid-template-columns: 60px 50px 50px 1fr; 
    align-items: center; 
    gap: 15px;
    padding: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.evt-item:hover { 
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.evt-date { 
    font-weight: 700; 
    color: var(--text-main); 
    text-align: center; 
    background: var(--bg-dark);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.evt-date span { display: block; font-size: 0.75rem; font-weight: 400; text-transform: uppercase; color: var(--text-muted); }
.evt-icon {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.evt-photo {
    width: 50px; height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}
@media (max-width: 768px) {
    .evt-list { grid-template-columns: 1fr; }
    .evt-item { grid-template-columns: 50px 40px 40px 1fr; gap: 10px; padding: 10px; }
    .evt-icon { width: 30px; height: 30px; font-size: 0.9rem; }
    .evt-photo { width: 40px; height: 40px; }
}

/* --- Tree Page Styles (Moved from tree.php) --- */
:root {
    /* Tree Specific Overrides */
    --bg-node: #974807;
    --bg-node-female: #60497B;
    --bg-node-deceased: #444;
    --text-male: #80ff80;
    --text-female: #ffff00;
    --line-color: #666;
    --hover-glow: rgba(255, 128, 0, 0.3);
    --accent: var(--accent-primary);
}

/* Print Styles */
@media print {
    #page-header, .controls, .legend, footer, .toggle-btn, .no-print { display: none !important; }
    body { background: white; color: black; }
    .tree-container { padding: 0; overflow: visible; }
    .tree li { page-break-inside: avoid; }
    .tree li.collapsed > ul { display: flex !important; }
    .node-card { background: #f5f5f5 !important; border: 1px solid #333 !important; }
    .name, .spouse-name { color: #333 !important; }
    .years { color: #666 !important; }
    .photo { border-color: #333 !important; }
}

/* Tree Controls Override */
.controls {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    padding: 15px 20px;
}

/* Ensure strict global select styling */
select {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 10px !important;
}


/* Additional Event Page Styles */
.evt-photo-placeholder {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
}

.evt-info { overflow: hidden; }
.evt-info strong { color: var(--text-main); font-size: 1.05rem; display: block; margin-bottom: 4px; }
.evt-details { font-size: 0.9rem; color: var(--text-muted); display: block; }

.month-header { 
    grid-column: 1 / -1;
    background: linear-gradient(90deg, var(--bg-color) 0%, transparent 100%);
    padding: 12px 15px; 
    border-left: 4px solid var(--accent-primary);
    margin-top: 30px; 
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1rem;
    position: sticky;
    top: 70px;
    backdrop-filter: blur(5px);
    z-index: 5;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.form-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg) !important;
    color: var(--text-main) !important;
    outline: none;
    cursor: pointer;
}

.form-select option {
    background: var(--card-bg);
    color: var(--text-main);
}
/* Image Lightbox Modal */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.image-modal-overlay.active {
    display: flex;
    opacity: 1;
}
.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.image-modal-overlay.active .image-modal-content {
    transform: scale(1);
}
.image-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}
