/**
 * PESO Administrator Portal Custom Stylesheet
 * City Government of Koronadal
 * Fully integrated with styles.css unified design system
 */

:root {
    --primary-blue: var(--palette-antique-rose, #c87d87);
    --primary-dark: #a85864;
    --primary-light: rgba(200, 125, 135, 0.15);
    --navy-dark: var(--text-main, #2b2526);
    --sidebar-width: 270px;
    --header-height: 70px;
    --bg-body: var(--bg-app, #faf8f6);
    --card-border: var(--border-light, rgba(200, 125, 135, 0.22));
    --success: var(--palette-dried-thyme, #6b7556);
    --warning: #d97706;
    --danger: #dc2626;
    --info: #4f46e5;
    --purple: #8b5cf6;
    --teal: var(--palette-dried-thyme, #6b7556);
}

body.dark-mode {
    --bg-body: var(--bg-app, #181516);
    --card-border: var(--border-light, rgba(200, 125, 135, 0.28));
    color: var(--text-main, #f5eff0);
}

body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .table,
body.dark-mode .sidebar,
body.dark-mode .top-navbar,
body.dark-mode .nav-tabs-custom {
    background-color: var(--bg-surface, #221e20) !important;
    color: var(--text-main, #f5eff0) !important;
    border-color: var(--border-light, rgba(200, 125, 135, 0.28)) !important;
}

body.dark-mode .table td,
body.dark-mode .table th {
    color: var(--text-main, #f5eff0) !important;
    border-color: var(--border-light, rgba(200, 125, 135, 0.28)) !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: var(--bg-subtle, #2d2729) !important;
    color: var(--text-main, #f5eff0) !important;
    border-color: var(--border-light, rgba(200, 125, 135, 0.28)) !important;
}

body.dark-mode .bg-light {
    background-color: var(--bg-subtle, #2d2729) !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main, 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif);
}

/* Modal & Backdrop Layering Safeguards */
.modal-backdrop {
    z-index: var(--z-modal-backdrop, 1050) !important;
}

.modal {
    z-index: var(--z-modal-dialog, 1055) !important;
    padding-top: calc(var(--header-height, 70px) + 50px + 1rem) !important;
}

.toast-container,
#notificationContainer,
.system-notification-container {
    z-index: var(--z-toast, 1090) !important;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Layout Container */
.app-container {
    margin-top: calc(var(--header-height, 70px) + 50px);
    padding: 1.75rem;
    min-height: calc(100vh - var(--header-height, 70px) - 50px);
}

/* Stats Cards */
.stat-card {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.stat-card .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card.blue .icon-wrapper {
    background: rgba(200, 125, 135, 0.15);
    color: var(--palette-antique-rose, #c87d87);
}

.stat-card.green .icon-wrapper {
    background: rgba(107, 117, 86, 0.18);
    color: var(--palette-dried-thyme-contrast, #545c43);
}

.stat-card.orange .icon-wrapper {
    background: rgba(251, 234, 214, 0.7);
    color: #b45309;
}

.stat-card.teal .icon-wrapper {
    background: rgba(229, 188, 169, 0.35);
    color: #8c4a55;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 0.5rem;
    line-height: 1;
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Content Cards & Tables */
.content-card {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-custom th {
    background-color: var(--bg-subtle) !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--card-border);
}

.table-custom td {
    padding: 0.95rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-main);
}

.table-custom tbody tr {
    transition: background 0.15s ease;
    cursor: pointer;
}

.table-custom tbody tr:hover {
    background-color: rgba(200, 125, 135, 0.05);
}

/* Badges */
.badge-category {
    padding: 0.35em 0.7em;
    font-weight: 600;
    border-radius: 6px;
    font-size: 0.75rem;
}

.badge-emp {
    background: rgba(200, 125, 135, 0.15);
    color: var(--palette-antique-rose, #c87d87);
}

.badge-livelihood {
    background: rgba(107, 117, 86, 0.18);
    color: var(--palette-dried-thyme-contrast, #545c43);
}

.badge-other {
    background: rgba(229, 188, 169, 0.35);
    color: #7a3e46;
}

.modal-header-custom {
    background: linear-gradient(135deg, var(--palette-antique-rose) 0%, #a85864 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-header-custom .btn-close {
    filter: brightness(0) invert(1);
}

.ordinance-banner {
    background: linear-gradient(135deg, #3d2f33 0%, #231c1e 100%);
    color: white;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    border: 1px solid var(--card-border);
}

.breadcrumb-custom {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow-card);
}

.masked-phone {
    font-family: monospace;
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid var(--card-border);
}

.badge-readonly {
    background: rgba(251, 234, 214, 0.7);
    color: #92400E;
    border: 1px solid rgba(251, 234, 214, 0.9);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ========================================================================= */
/* SCHEDULING MANAGEMENT MODULE CUSTOM CSS STYLES                            */
/* ========================================================================= */
.calendar-card {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.calendar-header {
    padding: 1.15rem 1.5rem;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--card-border);
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--card-border);
}

.calendar-day-header-cell {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid var(--card-border);
}

.calendar-day-header-cell:last-child {
    border-right: none;
}

.calendar-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day-cell {
    min-height: 125px;
    padding: 0.5rem;
    border-bottom: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    background: var(--bg-surface);
    position: relative;
    transition: all 0.15s ease;
    cursor: pointer;
    outline: none;
}

.calendar-day-cell:nth-child(7n) {
    border-right: none;
}

.calendar-day-cell:hover {
    background-color: var(--bg-subtle);
}

.calendar-day-cell:focus,
.calendar-day-cell.selected-focus {
    outline: 2px solid var(--palette-antique-rose) !important;
    outline-offset: -2px;
    background-color: var(--bg-subtle) !important;
    z-index: 2;
}

.calendar-day-cell.other-month {
    background-color: var(--bg-subtle);
    opacity: 0.45;
}

.calendar-day-cell.today {
    background-color: rgba(107, 117, 86, 0.08);
    box-shadow: inset 0 0 0 2px var(--palette-dried-thyme);
}

.calendar-day-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.calendar-day-number {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.calendar-day-cell.today .calendar-day-number {
    background: var(--palette-dried-thyme);
    color: #FFFFFF;
}

.day-add-btn {
    font-size: 0.7rem;
    padding: 0 4px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s ease;
    border: none;
    background: transparent;
}

.calendar-day-cell:hover .day-add-btn {
    opacity: 1;
}

/* Activity Event Chips in Calendar Cells */
.event-chip {
    padding: 0.28rem 0.45rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.28rem;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.event-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    filter: brightness(0.97);
}

/* Color-Coded Activity Status Classes */
.status-chip-green {
    background-color: rgba(107, 117, 86, 0.18);
    color: var(--palette-dried-thyme-contrast, #545c43);
    border: 1px solid rgba(107, 117, 86, 0.3);
}

.status-chip-blue {
    background-color: rgba(200, 125, 135, 0.15);
    color: var(--palette-antique-rose, #c87d87);
    border: 1px solid rgba(200, 125, 135, 0.3);
}

.status-chip-yellow {
    background-color: rgba(251, 234, 214, 0.8);
    color: #92400E;
    border: 1px solid rgba(251, 234, 214, 1);
}

.status-chip-red {
    background-color: rgba(254, 226, 226, 0.8);
    color: #991B1B;
    border: 1px solid rgba(254, 202, 202, 1);
}

.status-chip-gray {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
}

.legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Scheduled Activities Panel Cards */
.activity-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow-card);
}

.activity-card-item:hover {
    border-color: var(--palette-antique-rose);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.activity-card-item.status-border-green {
    border-left: 5px solid var(--palette-dried-thyme) !important;
}

.activity-card-item.status-border-blue {
    border-left: 5px solid var(--palette-antique-rose) !important;
}

.activity-card-item.status-border-yellow {
    border-left: 5px solid #d97706 !important;
}

.activity-card-item.status-border-red {
    border-left: 5px solid #dc2626 !important;
}

.activity-card-item.status-border-gray {
    border-left: 5px solid var(--text-muted) !important;
}

.time-badge {
    font-family: monospace;
    font-size: 0.8rem;
    background: var(--bg-subtle);
    color: var(--text-main);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

/* Dark Mode Extensions for Scheduling Module */
body.dark-mode .calendar-card,
body.dark-mode .calendar-header,
body.dark-mode .calendar-grid-header,
body.dark-mode .calendar-day-header-cell,
body.dark-mode .calendar-day-cell,
body.dark-mode .activity-card-item {
    background-color: var(--bg-surface, #221e20) !important;
    border-color: var(--border-light, rgba(200, 125, 135, 0.28)) !important;
    color: var(--text-main, #f5eff0) !important;
}

body.dark-mode .calendar-day-cell.other-month {
    background-color: var(--bg-subtle, #2d2729) !important;
    opacity: 0.35;
}

body.dark-mode .calendar-day-cell.today {
    background-color: rgba(107, 117, 86, 0.25) !important;
    box-shadow: inset 0 0 0 2px var(--palette-dried-thyme-contrast);
}

body.dark-mode .calendar-day-number {
    color: var(--text-main) !important;
}

body.dark-mode .time-badge {
    background-color: var(--bg-subtle, #2d2729) !important;
    color: var(--text-main, #f5eff0) !important;
    border-color: var(--border-light, rgba(200, 125, 135, 0.28)) !important;
}

/* Print / Compliance Export Media Styling */
@media print {
    .top-navbar,
    .nav-tabs-custom,
    .ordinance-banner,
    .btn,
    .card-header-custom select,
    .card-header-custom input {
        display: none !important;
    }

    .app-container {
        margin-top: 0 !important;
        padding: 0 !important;
    }

    .calendar-card,
    .content-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}
