/**
 * Pockets Calendar Styles
 * Shared styles for the Family Calendar feature
 */

/* ========================================
   Base/Layout Styles
   ======================================== */
html.calendar-page,
html.calendar-page body {
    background: #1e1e1e !important;
    margin: 0;
    padding: 0;
}

.calendar-page #main-wrapper {
    background: #1e1e1e;
}

.calendar-page .container-fluid {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

/* ========================================
   Header Styles
   ======================================== */
.calendar-header,
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}

.calendar-header h1,
.form-header h1 {
    margin: 0;
    color: #fff;
    font-size: 1.5rem;
}

.calendar-header .login-link,
.calendar-header a,
.form-header a {
    color: #aaa;
    text-decoration: none;
}

.calendar-header .login-link:hover,
.calendar-header a:hover,
.form-header a:hover {
    color: #fff;
}

/* ========================================
   Calendar Container & Filters
   ======================================== */
.calendar-container {
    padding: 20px;
    background: #1e1e1e;
    min-height: calc(100vh - 80px);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.filter-label {
    color: #aaa;
    font-size: 0.9rem;
    margin-right: 5px;
}

.member-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.member-pill {
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    border: 2px solid transparent;
    color: #fff;
}

.member-pill.active {
    border-color: #fff;
}

.member-pill:hover {
    opacity: 0.8;
}

.type-filter {
    margin-left: auto;
}

.type-filter select {
    background: #2d2d2d;
    color: #fff;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 4px;
}

.add-event-btn {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}

.add-event-btn:hover {
    background: #0056b3;
    color: #fff;
}

/* ========================================
   FullCalendar Overrides
   ======================================== */
#calendar {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
}

.fc {
    color: #fff;
}

.fc .fc-toolbar-title {
    color: #fff;
}

.fc .fc-button {
    background: #444;
    border-color: #555;
}

.fc .fc-button:hover {
    background: #555;
}

.fc .fc-button-active {
    background: #007bff !important;
    border-color: #007bff !important;
}

.fc .fc-daygrid-day {
    background: #2d2d2d;
}

.fc .fc-daygrid-day:hover {
    background: #3d3d3d;
}

.fc .fc-daygrid-day-number {
    color: #ccc;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.fc .fc-daygrid-day-number:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.fc .fc-col-header-cell-cushion {
    color: #aaa;
}

.fc .fc-col-header {
    background: #2d2d2d;
}

.fc .fc-col-header-cell {
    background: #2d2d2d;
    border-color: #444;
}

.fc th {
    background: #2d2d2d;
    color: #aaa;
    border-color: #444;
}

.fc td {
    border-color: #444;
}

.fc .fc-scrollgrid {
    border-color: #444;
}

.fc .fc-daygrid-day.fc-day-today {
    background: #3a3a5a !important;
}

/* Make calendar rows taller to fit more events */
.fc .fc-daygrid-body-balanced .fc-daygrid-day-frame {
    min-height: 160px !important;
}

/* Week view - make rows much taller since there's only one row */
.fc-dayGridWeek-view .fc-daygrid-body-balanced .fc-daygrid-day-frame,
.fc-dayGridWeek-view .fc-daygrid-body-unbalanced .fc-daygrid-day-frame {
    min-height: 500px !important;
}

.fc-dayGridWeek-view .fc-daygrid-day {
    min-height: 500px !important;
}

.fc-dayGridWeek-view .fc-daygrid-day-events {
    min-height: 460px !important;
}

.fc .fc-daygrid-day {
    min-height: 160px !important;
}

.fc-scrollgrid-sync-table {
    height: auto !important;
}

.fc .fc-scrollgrid-section-body > td {
    height: auto !important;
}

.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-frame {
    min-height: 160px !important;
}

.fc-daygrid-day-events {
    min-height: 120px !important;
}

.fc-event {
    cursor: pointer;
    border: none !important;
    font-size: 0.85em;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fc-event-title {
    padding: 2px 4px;
    color: #fff !important;
    font-weight: 500;
}

.fc-event-title .reward-star {
    color: #ffc107;
    font-size: 0.85em;
    margin-right: 2px;
}

/* Assignee badges on calendar events */
.event-assignee-badges {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
    vertical-align: middle;
    flex-wrap: wrap;
}

.event-assignee-badge {
    padding: 1px 6px;
    border-radius: 10px;
    display: inline-block;
    font-size: 0.7em;
    color: #fff;
    font-weight: 500;
}

.fc-event-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 2px 4px;
}

.fc-event-title-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* ========================================
   Event Modal
   ======================================== */
.event-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.event-modal.show {
    display: flex;
}

.event-modal-content {
    background: #2d2d2d;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.event-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border-bottom: 1px solid #444;
}

.event-modal-header h3 {
    margin: 0;
    color: #fff;
}

.event-modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.event-modal-close:hover {
    color: #fff;
}

.event-modal-body {
    padding: 20px;
    color: #ccc;
}

.event-detail-row {
    margin-bottom: 15px;
}

.event-detail-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.event-detail-value {
    color: #fff;
}

.event-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fff;
}

.assignee-dots {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.assignee-dot {
    display: flex;
    align-items: center;
    gap: 6px;
}

.assignee-dot-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.event-modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #444;
}

/* ========================================
   Form Styles (Create/Edit)
   ======================================== */
.form-container {
    padding: 20px;
    background: #1e1e1e;
    min-height: calc(100vh - 80px);
}

.event-form {
    max-width: 600px;
    margin: 0 auto;
    background: #2d2d2d;
    border-radius: 8px;
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #aaa;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group label.required::after {
    content: ' *';
    color: #dc3545;
}

.calendar-page .form-control {
    width: 100%;
    padding: 10px 12px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 1rem;
}

.calendar-page .form-control:focus {
    outline: none;
    border-color: #007bff;
}

.calendar-page select.form-control {
    cursor: pointer;
    line-height: 1.5;
    height: auto;
}

.calendar-page textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ========================================
   Checkbox Styles
   ======================================== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    -moz-appearance: none;
         appearance: none;
    -webkit-appearance: none;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    position: relative;
}

.checkbox-item input[type="checkbox"]:checked {
    background: #007bff;
    border-color: #007bff;
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: #fff;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-item input[type="checkbox"]:focus {
    outline: none;
    border-color: #007bff;
}

.checkbox-item .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ========================================
   Switch/Toggle Styles
   ======================================== */
.switch-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #444;
    border-radius: 26px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background: #007bff;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ========================================
   Time Row
   ======================================== */
.time-row {
    display: flex;
    gap: 15px;
}

.time-row .form-group {
    flex: 1;
}

/* ========================================
   Recurrence Styles
   ======================================== */
.recurrence-section {
    background: #1e1e1e;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
}

.recurrence-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.recurrence-row .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.weekday-checks {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.weekday-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: #ccc;
}

/* ========================================
   Button Styles
   ======================================== */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.btn-submit {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-submit:hover {
    background: #0056b3;
}

.btn-cancel {
    background: #444;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}

.btn-cancel:hover {
    background: #555;
    color: #fff;
}

.btn-edit {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.btn-edit:hover {
    background: #0056b3;
    color: #fff;
}

.btn-delete {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete:hover {
    background: #c82333;
}

/* Form-specific delete button (larger) */
.btn-row .btn-delete {
    padding: 12px 24px;
    font-size: 1rem;
    margin-left: auto;
}

.error-message {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 5px;
}

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

/* Tablet styles - keep filters row horizontal but adjust spacing */
@media (max-width: 900px) {
    .filters-row {
        gap: 8px;
    }

    .filter-label {
        display: none;
    }

    .member-pill {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .type-filter select {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .rewards-btn,
    .add-event-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Small tablet / large phone - allow wrapping but keep items inline where possible */
@media (max-width: 700px) {
    .filters-row {
        flex-wrap: wrap;
        gap: 10px;
        row-gap: 12px;
    }

    .member-filters {
        flex: 1 1 auto;
        min-width: 200px;
    }

    .type-filter {
        margin-left: 0;
    }
}

/* Mobile styles - stack vertically */
@media (max-width: 500px) {
    .calendar-header,
    .form-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .member-filters {
        justify-content: center;
    }

    .type-filter {
        width: 100%;
    }

    .type-filter select {
        width: 100%;
    }

    .rewards-btn,
    .add-event-btn {
        width: 100%;
        justify-content: center;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .time-row {
        flex-direction: column;
    }

    .recurrence-row {
        flex-direction: column;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn-row .btn-delete {
        margin-left: 0;
    }
}

/* ========================================
   Rewards Button
   ======================================== */
.rewards-btn {
    background: #2d2d2d;
    color: #ffc107;
    border: 1px solid #ffc107;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.rewards-btn:hover {
    background: #ffc107;
    color: #1e1e1e;
}

.rewards-btn i {
    font-size: 1rem;
}

/* ========================================
   Rewards Modal
   ======================================== */
.rewards-modal-content {
    max-width: 550px;
    width: 90%;
}

.rewards-modal-content .event-modal-body {
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.reward-card {
    background: #2d2d2d;
    padding: 24px;
    border-bottom: 1px solid #444;
}

.reward-card:last-child {
    border-bottom: none;
}

.reward-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.reward-name {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reward-name::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.reward-reset-btn {
    background: transparent;
    border: 1px solid #28a745;
    color: #28a745;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.reward-reset-btn:hover {
    background: #28a745;
    color: #fff;
}

.reward-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.reward-total {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reward-total i {
    opacity: 0.8;
}

.reward-item {
    background: linear-gradient(135deg, #6f42c1 0%, #9f7aea 100%);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reward-item i {
    opacity: 0.8;
}

.no-rewards {
    color: #888;
    font-style: italic;
    padding: 8px 0;
}

.reward-completions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #444;
}

.completions-toggle {
    color: #aaa;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    transition: color 0.2s;
}

.completions-toggle:hover {
    color: #fff;
}

.completions-toggle i {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.completions-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    background: #252525;
    border-radius: 8px;
    overflow: hidden;
}

.completions-list li {
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
    color: #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.completions-list li:last-child {
    border-bottom: none;
}

.completion-reward {
    color: #ffc107;
    font-weight: 500;
    margin-left: 12px;
}

.loading {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    font-size: 1rem;
}

.error {
    color: #dc3545;
    text-align: center;
    padding: 40px 20px;
}

/* ========================================
   Chore Completion Buttons
   ======================================== */
#modal-chore-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chore-complete-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #2d2d2d;
    border: 2px solid #555;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.chore-complete-btn:hover {
    background: #3d3d3d;
    border-color: #777;
}

.chore-complete-btn.completed {
    background: rgba(40, 167, 69, 0.15);
    border-color: #28a745;
}

.chore-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chore-check i {
    font-size: 11px;
    color: #fff;
}

.chore-complete-btn:not(.completed) .chore-check i {
    display: none;
}

.chore-complete-btn:hover:not(.completed) .chore-check i {
    display: block;
    opacity: 0.4;
}

/* ========================================
   Form Help Text
   ======================================== */
.form-help {
    color: #888;
    font-size: 0.8rem;
    margin-top: 6px;
    display: block;
}

