/* Mini kalendara komponentes izskats un statusi. */

/* ===== KALENDĀRA STILI - MAZS KALENDĀRS ===== */

/* Kalendāra konteiners */
.kalendars-container {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(82,5,5,0.08);
    border: 1px solid rgba(82,5,5,0.1);
    width: 100%;
    max-width: 300px;
}

.kalendars {
    width: 100%;
    font-family: 'Roboto', sans-serif;
}

/* Mēnesis/gads režīms: tikai toolbar bez dienu režģa */
.kalendars-container.month-year-only .kalendars {
    display: none;
}

.kalendars-container.month-year-only {
    max-width: 100%;
    padding: 10px;
}

/* ===== DATUMA/LAIKA IEVADES STILI ===== */
.datetime-input-row {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 10px;
    align-items: start;
}

.datetime-date-col,
.datetime-time-col {
    width: 100%;
}

.datetime-time-col {
    position: relative;
}

.time-dropdown {
    position: relative;
}

.time-dropdown-trigger {
    width: 100%;
    height: 42px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: #fff;
    color: #520505;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    padding: 0 42px 0 12px;
    transition: all 0.3s;
    position: relative;
}

.time-dropdown-trigger::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #520505;
    border-bottom: 2px solid #520505;
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.2s;
}

.time-dropdown-trigger:hover {
    border-color: #d7dbe0;
}

.time-dropdown:focus-within .time-dropdown-trigger {
    border-color: #000;
    box-shadow: none;
}

.time-dropdown-trigger:focus,
.time-dropdown-trigger:focus-visible {
    outline: none;
    border-color: #000;
    box-shadow: none;
}

.time-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 260px;
    background: #fff;
    border: 1px solid rgba(82,5,5,0.15);
    border-radius: 12px;
    box-shadow: 0 8px 26px rgba(82,5,5,0.16);
    padding: 12px;
    z-index: 1200;
    display: none;
}

.time-dropdown-menu.open {
    display: block;
}

.time-menu-section + .time-menu-section {
    margin-top: 10px;
}

.time-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #7a0f0f;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.time-hours-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
}

.time-minutes-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.time-chip {
    border: 1px solid rgba(82,5,5,0.22);
    background: #f8f9fa;
    color: #520505;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-chip:hover {
    background: #fff;
    border-color: #520505;
    transform: translateY(-1px);
}

.time-chip.active {
    background: #520505;
    color: #fff;
    border-color: #520505;
    box-shadow: 0 3px 8px rgba(82,5,5,0.25);
}

.time-select-native {
    display: none;
}

.time-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0 8px;
    transition: all 0.3s;
}

.time-select-group:hover {
    border-color: #d7dbe0;
}

.time-select-group:focus-within {
    border-color: #ffcc00;
    box-shadow: 0 0 0 3px rgba(255,204,0,0.2);
}

.time-select {
    flex: 1;
    min-width: 0;
    height: 34px;
    border: 1px solid rgba(82,5,5,0.18);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 1rem;
    color: #520505;
    background-color: #f8f9fa;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #520505 50%), linear-gradient(135deg, #520505 50%, transparent 50%);
    background-position: calc(100% - 16px) 13px, calc(100% - 10px) 13px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.time-select:hover {
    border-color: rgba(82,5,5,0.35);
    background-color: #fff;
}

.time-select:focus {
    outline: none;
    border-color: #520505;
    box-shadow: 0 0 0 2px rgba(82,5,5,0.12);
}

.time-select option {
    color: #2d3748;
    background: #fff;
}

.time-separator {
    font-weight: 700;
    color: #520505;
    line-height: 1;
    font-size: 1rem;
}

.datetime-time-col::before {
    content: none;
}

.date-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-icon-btn {
    background: #520505;
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.calendar-icon-btn:hover {
    background: #7a0f0f;
    transform: scale(1.05);
}

.time-input {
    width: 100%;
    height: 42px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0 12px 0 34px;
    font-size: 1rem;
    color: #333;
    background: #fff;
    transition: all 0.3s;
}

.time-input:hover {
    border-color: #d7dbe0;
}

.time-input:focus {
    outline: none;
    border-color: #ffcc00;
    box-shadow: 0 0 0 3px rgba(255,204,0,0.2);
}

.time-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.8;
    filter: sepia(1) saturate(4) hue-rotate(330deg);
}

.time-input::-webkit-datetime-edit {
    color: #2d3748;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.time-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.time-input::-webkit-datetime-edit-hour-field,
.time-input::-webkit-datetime-edit-minute-field {
    background: rgba(82, 5, 5, 0.08);
    color: #520505;
    border-radius: 6px;
    padding: 2px 4px;
}

.time-input::-webkit-datetime-edit-text {
    color: #7a0f0f;
    padding: 0 4px;
    font-weight: 700;
}

.time-input::-webkit-inner-spin-button {
    opacity: 0.6;
    cursor: pointer;
}

.time-input::-webkit-clear-button {
    display: none;
}

.time-input:focus::-webkit-datetime-edit-hour-field,
.time-input:focus::-webkit-datetime-edit-minute-field {
    background: rgba(255, 204, 0, 0.25);
}

.time-input:disabled {
    background: #f4f4f4;
    color: #8a8a8a;
    cursor: not-allowed;
}

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

/* ===== PIELĀGOTAIS TOOLBAR ===== */
.custom-calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 5px 0;
    font-family: 'Roboto', sans-serif;
}

.toolbar-left,
.toolbar-right {
    flex: 0 0 auto;
}

.toolbar-center {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.toolbar-btn {
    background: none;
    border: none;
    color: #520505;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background-color: rgba(82,5,5,0.1);
    color: #7a0f0f;
}

/* Mēneša selektors */
.month-selector {
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid rgba(82,5,5,0.2);
    min-width: 100px;
    text-align: center;
}

.current-month {
    font-weight: 600;
    color: #520505;
    display: inline-block;
}

/* Mēneša dropdown - 4 rindas, 3 mēneši katrā */
.month-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(82,5,5,0.15);
    list-style: none;
    padding: 12px;
    margin: 8px 0 0;
    z-index: 1000;
    display: none;
    width: 280px;
    border: 1px solid rgba(82,5,5,0.1);
}

.month-dropdown.active {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.month-dropdown li {
    padding: 10px 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #333;
    text-align: center;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 2px solid #520505;
    font-weight: 500;
    list-style: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Neizvēlētie mēneši */
.month-dropdown li:not(.current-month-item) {
    border-color: #520505;
    color: #333;
    background-color: #f8f9fa;
}

/* Izvēlētais mēnesis */
.month-dropdown li.current-month-item {
    background-color: #520505;
    color: white;
    font-weight: 600;
    border-color: #520505;
}

.month-dropdown li:hover {
    background-color: #520505;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(82,5,5,0.2);
    border-color: #520505;
}

.month-dropdown.active {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gada selektors */
.year-selector {
    position: relative;
    cursor: pointer;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid rgba(82,5,5,0.2);
    min-width: 80px;
    text-align: center;
}

.current-year {
    font-weight: 600;
    color: #520505;
    display: inline-block;
}

.year-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px;
    margin: 5px 0 0;
    z-index: 1000;
    display: none;
    min-width: 200px;
}

.year-dropdown.active {
    display: block;
}

.year-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.year-nav-btn {
    background: none;
    border: none;
    color: #520505;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.year-nav-btn:hover {
    background-color: rgba(255, 204, 0, 0.1);
    color: #7a0f0f;
}

.year-range {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.year-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.year-list li {
    padding: 5px;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.85rem;
    color: #333;
}

.year-list li:hover {
    background-color: rgba(255, 204, 0, 0.1);
    color: #520505;
}

.year-list li.selected {
    background-color: #520505;
    color: white;
    font-weight: 600;
}

/* ===== FULLCALENDAR STILA PIELĀGOJUMI ===== */
.fc {
    --fc-border-color: transparent !important;
    --fc-today-bg-color: rgba(255, 204, 0, 0.08);
    --fc-event-bg-color: transparent;
    --fc-event-border-color: transparent;
    --fc-event-text-color: #520505;
    --fc-page-bg-color: white;
    --fc-neutral-bg-color: transparent;
    font-size: 0.85rem !important;
    border: none !important;
}

/* Noņem visas robežlīnijas */
.fc table,
.fc tbody,
.fc thead,
.fc tr,
.fc th,
.fc td {
    border: none !important;
    border-style: none !important;
    border-width: 0 !important;
}

/* ===== NEDĒĻAS DIENU GALVENES ===== */
.fc .fc-col-header-cell {
    background-color: transparent !important;
    padding: 6px 0 !important;
}

.fc .fc-col-header-cell-cushion {
    font-weight: 600;
    color: #520505;
    text-decoration: none;
    font-size: 0.75rem !important;
    text-transform: uppercase;
}

/* ===== DIENU ŠŪNAS ===== */
.fc .fc-daygrid-day {
    background-color: transparent !important;
    border: none !important;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.fc .fc-daygrid-day:hover {
    background-color: rgba(255, 204, 0, 0.1) !important;
}

.fc .fc-daygrid-day-number {
    color: #333;
    font-size: 0.8rem !important;
    font-weight: 500;
    padding: 4px !important;
    text-decoration: none;
    text-align: center;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== PAGĀJUŠIE DATUMI (TĀDI PAŠI KĀ NĀKOTNES) ===== */
.fc .fc-day-past .fc-daygrid-day-number {
    color: #333 !important;
    opacity: 1;
}

.fc .fc-day-past.fc-day-with-event .fc-daygrid-day-number {
    background-color: #520505 !important;
    color: white !important;
    box-shadow: 0 2px 4px rgba(82,5,5,0.2);
}

/* ===== NĀKOTNES DATUMI (MELNI) ===== */
.fc .fc-day-future .fc-daygrid-day-number {
    color: #333 !important;
}

/* ===== PASĀKUMU DIENAS ===== */
.fc-daygrid-day.fc-day-with-event .fc-daygrid-day-number {
    background-color: #520505;
    color: white !important;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin: 0 auto;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(82,5,5,0.2);
}

/* ===== ŠODIENAS DIENA ===== */
.fc .fc-day-today {
    background-color: transparent !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    font-weight: 700;
    color: #520505;
    border: 2px solid #ffcc00;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    margin: 0 auto;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* Ja šodien ir arī pasākums */
.fc-day-today.fc-day-with-event .fc-daygrid-day-number {
    background-color: #520505;
    color: white !important;
    border: 2px solid #ffcc00;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.22), 0 2px 4px rgba(82,5,5,0.2);
}

/* ===== IZVĒLĒTAIS DATUMS ===== */
.fc-day-selected {
    background-color: rgba(82,5,5,0.1) !important;
    border-radius: 50%;
}

.fc-day-selected .fc-daygrid-day-number {
    font-weight: 700;
    color: #520505 !important;
    transform: scale(1.1);
}

/* ===== PASĀKUMU NOTIKUMI (PASLĒPJAM) ===== */
.fc-event {
    display: none !important;
}

.fc-daygrid-day-events {
    display: none !important;
}

/* ===== RESPONSĪVAIS DIZAINS ===== */
@media (max-width: 992px) {
    .kalendars-container {
        max-width: 100%;
        margin-bottom: 20px;
    }

    .custom-calendar-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .toolbar-center {
        order: 2;
        width: 100%;
        justify-content: center;
    }

    .toolbar-left,
    .toolbar-right {
        order: 1;
    }
}

@media (max-width: 768px) {
    .datetime-input-row {
        grid-template-columns: 1fr;
    }

    .time-dropdown-menu {
        min-width: 0;
    }

    .time-hours-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Telefonā kalendārs atveras pilnā platumā no kreisās līdz labajai malai. */
    .kalendars-container {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 85vh;
        overflow-y: auto;
        margin: 0 !important;
        padding: 12px;
        border-radius: 16px 16px 0 0;
        z-index: 1600 !important;
        box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.22);
        box-sizing: border-box;
    }

    .custom-calendar-toolbar {
        margin-bottom: 10px;
        gap: 8px;
    }

    .toolbar-center {
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 8px;
    }

    .toolbar-btn,
    .month-selector,
    .year-selector {
        min-height: 40px;
    }

    .month-selector,
    .year-selector {
        min-width: 0;
        width: calc(50% - 4px);
        font-size: 0.85rem;
        box-sizing: border-box;
    }

    .month-dropdown,
    .year-dropdown {
        position: static;
        left: auto;
        right: auto;
        width: 100%;
        min-width: 0;
        margin-top: 8px;
        box-sizing: border-box;
    }

    .month-dropdown.active {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 220px;
        overflow-y: auto;
    }

    .year-list {
        max-height: 180px;
    }

    .fc .fc-col-header-cell-cushion {
        font-size: 0.72rem !important;
        line-height: 1.1 !important;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.78rem !important;
        line-height: 1 !important;
        padding: 2px !important;
    }

    .fc .fc-scrollgrid,
    .fc .fc-scrollgrid-sync-table,
    .fc .fc-daygrid-body {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Fiksējam 7 vienādas kolonnas, lai visas nedēļas dienas vienmēr ir redzamas. */
    .fc .fc-scrollgrid table,
    .fc .fc-daygrid-body table,
    .fc .fc-col-header table {
        width: 100% !important;
        table-layout: fixed !important;
    }

    .fc .fc-col-header-cell,
    .fc .fc-daygrid-day {
        width: 14.2857% !important;
        max-width: 14.2857% !important;
        min-width: 0 !important;
    }

    /* FullCalendar bieži ieliek px platumus colgroup līmenī - tos pārrakstām telefonam. */
    .fc .fc-scrollgrid colgroup col,
    .fc .fc-scrollgrid-sync-table colgroup col,
    .fc .fc-col-header colgroup col,
    .fc .fc-daygrid-body colgroup col {
        width: calc(100% / 7) !important;
        min-width: 0 !important;
    }

    .fc .fc-view-harness,
    .fc .fc-view-harness-active,
    .fc .fc-daygrid,
    .fc .fc-scroller-harness {
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .fc .fc-scroller {
        overflow-x: hidden !important;
    }

    .fc-daygrid-day.fc-day-with-event .fc-daygrid-day-number,
    .fc .fc-day-today .fc-daygrid-day-number {
        width: 24px;
        height: 24px;
        font-size: 0.7rem !important;
    }
}

@media (max-width: 576px) {
    .kalendars-container {
        padding: 10px;
    }

    .month-selector,
    .year-selector {
        width: 100%;
    }

    .month-dropdown.active {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .fc .fc-col-header-cell-cushion {
        font-size: 0.68rem !important;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.74rem !important;
    }
}
