/* =================
   CALENDAR STYLES
   Colors: #E62727, #7f8c8d, white
   ================= */

/* Global Reset for Calendar */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Override body styles for navbar integration */
body.calendar-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: #2c3e50;
}

/* Calendar Container - adjusted for navbar/sidebar layout */
.container {
    max-width: none;
    margin: 0;
    padding: 25px;
}

/* Page Header - adjusted for main content area */
.page-header {
    text-align: center;
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-top: 0;
}

.page-header h2 {
    color: #E62727;
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

/* Calendar Navigation */
.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    padding: 20px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    gap: 20px;
}

.nav-btn {
    background: #E62727;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(230, 39, 39, 0.3);
}

.nav-btn:hover {
    background: #c41e1e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 39, 39, 0.4);
}

.month-year-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

#monthSelect, #yearSelect {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

#monthSelect:focus, #yearSelect:focus {
    outline: none;
    border-color: #E62727;
    box-shadow: 0 0 0 3px rgba(230, 39, 39, 0.1);
}

/* Section Styling */
.section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.section h3 {
    color: #E62727;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f8f9fa;
}

/* Calendar Table */
.calendar {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    margin-top: 20px;
}

.calendar th {
    background: #E62727;
    color: white;
    padding: 15px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
}

.calendar td {
    background: white;
    min-height: 120px;
    padding: 12px 8px;
    vertical-align: top;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    border: 2px solid transparent;
    position: relative;
}

.calendar td:hover {
    background: #f8f9fa;
    border-color: #E62727;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 39, 39, 0.2);
}

.calendar td.today {
    background: linear-gradient(135deg, #fff3f3, #ffffff);
    border-color: #E62727;
    font-weight: 600;
}

.calendar td.today:hover {
    background: linear-gradient(135deg, #ffe6e6, #f8f9fa);
}

/* Day Numbers */
.day-number {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    text-align: center;
}

.calendar td.today .day-number {
    color: #E62727;
    font-size: 18px;
}

/* Event Styling */
.event {
    background: #fdf2f2;
    border-left: 4px solid #e74c3c;
    margin: 5px 0;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
}

.event strong {
    color: #e74c3c;
    font-weight: 600;
}

.delivery {
    background: #f8f9fa;
    border-left: 4px solid #7f8c8d;
    margin: 5px 0;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
}

.delivery.pending {
    background: #fef9e7;
    border-left-color: #f39c12;
}

.delivery.delivered {
    background: #eafaf1;
    border-left-color: #27ae60;
}

.delivery.canceled {
    background: #f8f9fa;
    border-left-color: #95a5a6;
}

/* Action Buttons in Calendar */
.btn-claim, .btn-cancel {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    margin: 2px 1px;
    transition: all 0.2s ease;
}

.btn-claim {
    background: #27ae60;
    color: white;
}

.btn-claim:hover {
    background: #229954;
}

.btn-cancel {
    background: #e74c3c;
    color: white;
}

.btn-cancel:hover {
    background: #c0392b;
}

/* Form Section */
.form-section {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid #e9ecef;
}

.form-section h3 {
    color: #E62727;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3::before {
    content: "📝";
    font-size: 20px;
}

/* Form Styling */
.form-section form {
    max-width: 600px;
}

.form-section table {
    width: 100%;
}

.form-section td {
    padding: 10px 0;
    vertical-align: top;
}

.form-section label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

/* Input Styling */
input[type="text"], 
input[type="date"], 
textarea {
    width: 100%;
    max-width: 350px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

input[type="text"]:focus, 
input[type="date"]:focus, 
textarea:focus {
    outline: none;
    border-color: #E62727;
    box-shadow: 0 0 0 3px rgba(230, 39, 39, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Main Action Button */
.btn {
    background: #E62727;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(230, 39, 39, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    background: #c41e1e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 39, 39, 0.4);
}

/* Error Messages */
.error {
    color: #e74c3c;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    display: block;
}

/* Form Divider */
.form-section hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, #E62727, #7f8c8d);
    margin: 20px 0;
    border-radius: 2px;
}

/* Modal & action button styles for planner details modal */
#detailsModal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.5);
    display: none;
}
#detailsModal .modal-content {
    background: #fff;
    margin: 6% auto;
    padding: 20px;
    border-radius: 6px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: relative;
    padding-top: 46px; /* add extra top padding so fixed close button doesn't overlap content */
}
#detailsModal .close {
    position: fixed;
    right: 18px;
    top: 14px;
    font-size: 26px;
    cursor: pointer;
    z-index: 10001;
    background: transparent;
    color: #fff;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6); /* optional: make the close more visible on darker overlay */
}
#detailsModal .modal-section { margin-bottom: 12px; }
#detailsModal .small { color: #555; font-size: 0.9em; margin-top:4px; }
.delivery-row { padding:8px 0; border-bottom:1px solid #eee; }
.delivery-row:last-child { border-bottom: none; }
.actions { margin-top:8px; }

/* Action buttons */
.btn-claim {
    background:#28a745;
    color:#fff;
    border:0;
    padding:6px 10px;
    border-radius:4px;
    cursor:pointer;
}
.btn-cancel {
    background:#dc3545;
    color:#fff;
    border:0;
    padding:6px 10px;
    border-radius:4px;
    cursor:pointer;
}

.status { color:#666; font-size:0.95em; margin-left:6px; }

/* Centered and styled date heading inside the modal */
#detailsModal .modal-content .modal-date {
    text-align: center;
    font-size: 1.15em;
    margin: 0 0 12px 0;
    color: #333;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .calendar-nav {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .month-year-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    #monthSelect, #yearSelect {
        width: 100%;
    }
    
    .calendar th, .calendar td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .calendar td {
        min-height: 80px;
    }
    
    .day-number {
        font-size: 14px;
    }
    
    .event, .delivery {
        font-size: 10px;
        padding: 4px 6px;
    }
    
    .section {
        padding: 20px;
    }
    
    .form-section table {
        width: 100%;
    }
    
    input[type="text"], 
    input[type="date"], 
    textarea {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .page-header h2 {
        font-size: 22px;
    }
    
    .calendar th, .calendar td {
        padding: 6px 2px;
        font-size: 11px;
    }
    
    .calendar td {
        min-height: 60px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .nav-btn {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 14px;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section {
    animation: fadeIn 0.6s ease-out;
}

/* Hover Effects for Better UX */
.calendar td {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar td:hover .event,
.calendar td:hover .delivery {
    transform: translateX(2px);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
}

/* Status Indicators */
.delivery::before {
    content: "🚚";
    margin-right: 5px;
}

.delivery.delivered::before {
    content: "✅";
}

.delivery.canceled::before {
    content: "❌";
}

.event::before {
    content: "⚠️";
    margin-right: 5px;
}