/* Custom styles for Jihye Maru Library (Premium) */
:root {
    --bs-body-font-family: 'Noto Sans KR', sans-serif;

    /* Modern Palette */
    --primary-color: #00BFA5;
    /* Teal */
    --primary-hover: #008f7a;
    --accent-color: #FF6B6B;

    /* Premium Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: blur(12px);

    --soft-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);

    --border-radius: 16px;

    /* Background Gradient */
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: #2c3e50;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}

/* Typography & Layout */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #1a202c;
}

/* Glassmorphism Components */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--soft-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: rgba(255, 255, 255, 0.8);
}

.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Premium Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 100px;
    /* Pill shape */
    font-weight: 600;
    padding: 10px 24px;
    box-shadow: 0 4px 15px rgba(0, 191, 165, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 191, 165, 0.4);
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

/* Inputs */
.form-control,
.form-select {
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 12px 15px;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-control:focus,
.form-select:focus {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 191, 165, 0.1);
    border-color: var(--primary-color);
}

/* Dark Mode Removed */
/* Navbar Blur */
.navbar-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

/* Specific UI Elements */
.terms-box {
    height: 150px;
    overflow-y: scroll;
    padding: 15px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Notice Banner Floating */
.notice-banner {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    color: #0d47a1;
    border-radius: var(--border-radius);
    padding: 15px 25px;
    margin-bottom: 25px;
    border-left: 6px solid var(--primary-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
}

/* 3. Calendar Mobile View Optimization */
@media (max-width: 768px) {
    .fc-toolbar {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 10px;
    }

    /* Move Title to Top Center */
    .fc-toolbar-chunk:nth-child(2) {
        order: 1;
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }

    /* Left Controls (Prev/Next) */
    .fc-toolbar-chunk:nth-child(1) {
        order: 2;
    }

    /* Right Controls (Views) */
    .fc-toolbar-chunk:nth-child(3) {
        order: 3;
    }

    .fc-toolbar-title {
        font-size: 1.1rem !important;
        /* Smaller title */
    }

    .fc .fc-button {
        padding: 0.4em 0.8em !important;
        /* Smaller buttons */
        font-size: 0.85em !important;
    }

    /* Compact Day Cells on Mobile */
    .fc-daygrid-day-frame {
        min-height: 80px !important;
        /* Ensure enough height for touch */
    }

    .fc-daygrid-day-number {
        font-size: 0.95rem;
        /* Readable number */
        padding: 4px 6px !important;
    }

    .fc-event {
        font-size: 0.75rem;
        /* Smaller event text */
        padding: 1px 3px;
    }

    .fc-col-header-cell-cushion {
        font-size: 0.9rem;
        /* Smaller weekday names */
        padding: 8px 0 !important;
    }
}

/* Calendar Customization */
.fc-toolbar-title {
    font-size: 1.75rem !important;
    font-weight: 800;
    color: #2c3e50;
}

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

.fc-theme-standard .fc-scrollgrid {
    border: none;
}

/* Highlight Today (Clearer) */
.fc-day-today {
    background-color: rgba(0, 191, 165, 0.15) !important;
    font-weight: bold;
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .fc-theme-standard td,
.dark-mode .fc-theme-standard th {
    border-color: rgba(255, 255, 255, 0.05);
}

.fc-daygrid-day-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    text-decoration: none !important;
}

/* Sunday Red */
.fc-day-sun .fc-col-header-cell-cushion,
.fc-day-sun .fc-daygrid-day-number,
.fc-day-sun .fc-list-day-text,
.fc-day-sun .fc-list-day-side-text {
    color: #e74c3c !important;
    /* Red */
}

/* Saturday Blue */
.fc-day-sat .fc-col-header-cell-cushion,
.fc-day-sat .fc-daygrid-day-number,
.fc-day-sat .fc-list-day-text,
.fc-day-sat .fc-list-day-side-text {
    color: #3498db !important;
    /* Blue */
}

/* Weekday Black (Default) */
.fc-day-mon .fc-col-header-cell-cushion,
.fc-day-mon .fc-daygrid-day-number,
.fc-day-tue .fc-col-header-cell-cushion,
.fc-day-tue .fc-daygrid-day-number,
.fc-day-wed .fc-col-header-cell-cushion,
.fc-day-wed .fc-daygrid-day-number,
.fc-day-thu .fc-col-header-cell-cushion,
.fc-day-thu .fc-daygrid-day-number,
.fc-day-fri .fc-col-header-cell-cushion,
.fc-day-fri .fc-daygrid-day-number {
    color: #2c3e50 !important;
    /* Dark/Black */
}


.dark-mode .fc-daygrid-day-number {
    color: #cbd5e0;
}

.fc-event {
    border-radius: 6px;
    border: none;
    padding: 3px 8px;
    background-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 191, 165, 0.3);
    transition: transform 0.2s;
}

.fc-event:hover {
    transform: scale(1.02);
}

/* Remove colored dot in List View */
.fc-list-event-dot {
    display: none !important;
}

/* Force Reset List View Styles (Nuclear Option) */
.fc-list-table .fc-list-event,
.fc-list-table .fc-list-event td,
.fc-list-table .fc-list-event:hover td {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #2c3e50 !important;
}

/* Add a subtle hover only */
.fc-list-table .fc-list-event:hover td {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* Ensure the dot is definitely gone */
.fc-list-event-graphic {
    display: none !important;
}


/* --- Mobile Landscape Optimization (Smartphones) --- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .container.py-5.mt-5 {
        padding-top: 1rem !important;
        margin-top: 3.5rem !important;
        /* Adjust for navbar */
        padding-bottom: 1rem !important;
    }

    .navbar-glass {
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
    }

    /* Hide floating notice in landscape to save space */
    .notice-banner {
        display: none !important;
    }

    /* Calendar Optimization for Landscape */
    .fc-toolbar-title {
        font-size: 1.2rem !important;
    }

    .fc-header-toolbar {
        margin-bottom: 0.5rem !important;
    }

    .fc-daygrid-day-frame {
        min-height: 40px !important;
        /* Compact height */
    }

    .fc-daygrid-day-number {
        font-size: 0.8rem;
        padding: 2px !important;
    }

    footer {
        display: none;
        /* Hide footer to maximize view */
    }
}

/* --- Mobile Portrait Refinement (Enhanced) --- */
@media (max-width: 768px) {

    /* 1. Global Layout & Spacing */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .container.py-4.mt-5 {
        margin-top: 3.5rem !important;
        /* Navbar height */
        padding-top: 0.5rem !important;
        padding-bottom: 2rem !important;
    }

    /* 2. Card Optimization */
    .card-body {
        padding: 1.25rem !important;
        /* Reduce from p-5/p-4 */
    }

    .card .p-5 {
        padding: 1.5rem !important;
        /* Override explicit p-5 classes */
    }

    /* 3. Typography scaling */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    /* 4. FullCalendar Mobile Override */
    .fc-daygrid-event-dot {
        display: none !important;
    }

    .fc-event {
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }


    h4 {
        font-size: 1.2rem;
    }

    h5 {
        font-size: 1.1rem;
    }

    .fs-5 {
        font-size: 1rem !important;
    }

    /* 4. Inputs & Buttons (Touch Targets) */
    .btn,
    .form-control,
    .form-select,
    .input-group-text {
        min-height: 48px;
        /* Slightly larger for thumb */
        font-size: 1rem;
    }

    .btn-sm {
        min-height: 36px;
        font-size: 0.85rem;
    }

    /* 5. Components */
    .notice-banner {
        padding: 12px;
        margin-bottom: 1rem !important;
        flex-direction: row;
        /* Keep row but tighter */
    }

    .notice-banner h5 {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .notice-banner p {
        font-size: 0.85rem;
    }

    /* 6. Calendar Toolbar Stacking */
    .fc-toolbar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem;
    }

    .fc-toolbar-chunk {
        display: flex;
        align-items: center;
    }

    /* Left Controls (Prev/Next) */
    .fc-toolbar-chunk:nth-child(1) {
        order: 2;
        /* Place after Title */
    }

    /* Title (Center -> First) */
    .fc-toolbar-chunk:nth-child(2) {
        order: 1;
        /* First */
        margin-bottom: 0 !important;
        width: auto !important;
        /* Allow shrinking */
    }

    /* Right Controls (Views) -> New Line */
    .fc-toolbar-chunk:nth-child(3) {
        order: 3;
        width: 100%;
        justify-content: flex-end;
        /* Align right on new line */
        margin-top: 5px;
    }

    .fc-toolbar-title {
        font-size: 1.3rem !important;
    }

    /* 7. Modal Full Widthish */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* 8. Table/List Adjustments */
    .list-group-item {
        padding: 0.75rem 1rem;
    }

    /* 9. Calendar Specific */
    #calendar {
        padding: 0.5rem !important;
        /* Reduce from p-3 */
    }
}

/* --- PC View: User Feedback Modal Position (Bottom Right) --- */
@media (min-width: 992px) {

    /* Override Bootstrap modal centering for this specific modal */
    .modal-bottom-right {
        margin: 0 !important;
        position: absolute !important;
        bottom: 110px !important;
        /* Above the FAB */
        right: 30px !important;
        width: 400px !important;
        max-width: 90vw !important;
        transform: none !important;
        pointer-events: none;
    }

    /* Enable pointer events on content */
    .modal-bottom-right .modal-content {
        pointer-events: auto;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    }
}