/* Global Styles */
:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --text-color: #333333;
    /* Dark Grey for high contrast */
    --text-muted: #666666;
    /* Muted text */
    --bg-color: #f4f6f9;
    /* Light Grey background */
    --card-bg: #ffffff;
    /* Solid White */
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Subtle shadow */
    --success-color: #00b09b;
    --danger-color: #ff5f6d;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-color);
    /* Solid Primary Color */
    /* Remove gradient text for better visibility */
}

.add-btn {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-container input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
    /* Very light grey */
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s;
}

.search-container input:focus {
    outline: none;
    background: white;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.search-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}



/* Schedule List */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.schedule-card {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    /* Stack vertically! */
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align to top */
    width: 100%;
    gap: 0.5rem;
}

/* Mobile: Stack Title above Date */
@media (max-width: 600px) {
    .schedule-header {
        flex-direction: column;
    }

    .schedule-header h3 {
        width: 100%;
        margin-bottom: 0.2rem;
        /* Reduced from 0.5rem */
        font-size: 1rem;
        /* Slightly smaller for mobile */
    }

    .header-meta {
        width: 100%;
        justify-content: space-between;
        /* Spread time and icon */
    }
}

.schedule-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
    flex: 1;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-icon {
    color: var(--text-muted);
    transition: transform 0.3s;
    font-size: 0.9rem;
}

.schedule-card.expanded .toggle-icon {
    transform: rotate(180deg);
}

.schedule-details {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
    width: 100%;
}

.schedule-card.expanded .schedule-details {
    display: block;
}

.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.schedule-card.completed {
    border-left: 5px solid #2ecc71;
    background: #f8fff9;
    /* Very light green tint */
}

.schedule-card.cancelled {
    border-left: 5px solid #e74c3c;
    background: #fff5f5;
    /* Very light red tint */
}

.schedule-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.schedule-content p {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    opacity: 1;
    color: var(--text-muted);
}

.time-badge {
    display: inline-block;
    background: #eef2f7;
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* Status Badges */

.status-completed {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-cancelled {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.status-btn-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.status-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover {
    background: #f1f3f5;
    color: var(--text-color);
    border-color: #ced4da;
}

.status-btn.active {
    font-weight: bold;
    color: white;
    border-color: transparent;
}

.status-btn.active.pending {
    background: #f39c12;
}

.status-btn.active.completed {
    background: #2ecc71;
}

.status-btn.active.cancelled {
    background: #e74c3c;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a2e;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--glass-border);
    position: relative;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    /* Updated to use variable */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #550db0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.schedule-card {
    animation: fadeIn 0.5s ease-out forwards;
}

/* View Toggles */
.view-btn {
    background: white;
    border: 1px solid var(--border-color);
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    font-weight: 500;
}

.view-btn:hover {
    background: #f1f3f5;
    color: var(--primary-color);
}

.view-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Calendar Styles */
.calendar-container {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.calendar-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.calendar-header button:hover {
    background: #f1f3f5;
    color: var(--primary-color);
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: var(--text-color);
}

.calendar-day:hover {
    background: #f1f3f5;
    color: var(--primary-color);
    font-weight: 600;
}

.calendar-day.today {
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    font-weight: 700;
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(106, 17, 203, 0.3);
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 5px;
    width: 5px;
    height: 5px;
    background: var(--danger-color);
    border-radius: 50%;
}

.calendar-day.other-month {
    opacity: 0.3;
    pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    header h1 {
        font-size: 1.8rem;
        width: 100%;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
        padding: 0.8rem;
    }

    .schedule-card {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        /* Make space for action buttons */
    }

    .schedule-content {
        width: 100%;
    }

    .schedule-actions {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(255, 255, 255, 0.1);
        padding: 0.3rem 0.5rem;
        border-radius: 20px;
    }

    .btn-icon {
        padding: 0.4rem;
        font-size: 1rem;
    }

    .status-btn-group {
        flex-wrap: wrap;
        margin-top: 1rem;
    }

    .status-btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
        min-width: 80px;
    }

    /* Stack Chat and Map buttons */
    .schedule-content>div[style*="display:flex"] {
        flex-wrap: wrap;
    }
}

.date-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0.1rem 0 0.1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-header i {
    font-size: 1rem;
}