/**
 * Flying Club Manager - Frontend Styles
 * Member interface styling
 */

/* ============================================
   General Styles
   ============================================ */

.fcm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   Forms
   ============================================ */

.fcm-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fcm-form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.fcm-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.fcm-form-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.fcm-form-group {
    margin-bottom: 15px;
}

.fcm-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.fcm-form-group input[type="text"],
.fcm-form-group input[type="email"],
.fcm-form-group input[type="number"],
.fcm-form-group input[type="time"],
.fcm-form-group input[type="date"],
.fcm-form-group select,
.fcm-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.fcm-form-group input:focus,
.fcm-form-group select:focus,
.fcm-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.fcm-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

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

.fcm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.fcm-datepicker {
    cursor: pointer;
}

.fcm-help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.fcm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================
   Buttons
   ============================================ */

.fcm-button {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.fcm-button-primary {
    background-color: #3498db;
    color: #fff;
}

.fcm-button-primary:hover {
    background-color: #2980b9;
    color: #fff;
}

.fcm-button-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.fcm-button-secondary:hover {
    background-color: #7f8c8d;
    color: #fff;
}

.fcm-button-small {
    padding: 6px 12px;
    font-size: 12px;
}

.fcm-button-link {
    background: none;
    color: #e74c3c;
    padding: 0;
    border: none;
    text-decoration: underline;
}

.fcm-button-link:hover {
    color: #c0392b;
}

.fcm-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Tables
   ============================================ */

.fcm-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.fcm-table thead {
    background-color: #2c3e50;
    color: #fff;
}

.fcm-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.fcm-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 14px;
}

.fcm-table tbody tr:last-child td {
    border-bottom: none;
}

.fcm-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* ============================================
   Badges
   ============================================ */

.fcm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.fcm-badge-success {
    background-color: #d4edda;
    color: #155724;
}

.fcm-badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.fcm-badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.fcm-badge-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ============================================
   Notices
   ============================================ */

.fcm-notice {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    background-color: #e7f3ff;
    color: #004085;
    border-left: 4px solid #3498db;
}

.fcm-notice-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.fcm-notice-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.fcm-no-data {
    padding: 40px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ============================================
   Reservations Calendar
   ============================================ */

.fcm-reservations-calendar {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Reset any theme styles that might interfere */
.fcm-reservations-calendar *,
.fcm-reservations-calendar *::before,
.fcm-reservations-calendar *::after {
    box-sizing: border-box;
    margin: 0;
}

/* Ultra-specific selectors to override theme CSS */
div.fcm-reservations-calendar div.fcm-calendar-grid {
    display: block !important;
}

div.fcm-reservations-calendar div.fcm-calendar-header-row,
div.fcm-reservations-calendar div.fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    grid-gap: 0 !important;
    gap: 0 !important;
}

/* Fallback for really stubborn themes */
@supports not (display: grid) {
    div.fcm-reservations-calendar div.fcm-calendar-header-row,
    div.fcm-reservations-calendar div.fcm-calendar-week {
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    div.fcm-reservations-calendar div.fcm-calendar-day,
    div.fcm-reservations-calendar div.fcm-calendar-day-name {
        flex: 1 1 14.28% !important;
        width: 14.28% !important;
    }
}

.fcm-calendar-header {
    margin-bottom: 20px;
}

.fcm-calendar-header h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}

.fcm-calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;
}

.fcm-aircraft-selector {
    flex: 1;
    min-width: 200px;
}

.fcm-aircraft-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.fcm-view-toggle {
    display: flex;
    gap: 5px;
}

.fcm-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s;
}

.fcm-view-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.fcm-view-btn.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.fcm-view-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.fcm-calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.fcm-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s;
}

.fcm-nav-btn:hover {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.fcm-nav-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.fcm-month-label {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.fcm-calendar-container {
    min-height: 300px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Calendar Grid */
.fcm-calendar-grid {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block !important;
    position: relative;
}

.fcm-calendar-header-row {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    grid-auto-flow: column !important;
    background: #2c3e50;
    color: #fff;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Even more specific to override Twenty Twenty-Five theme */
.fcm-reservations-calendar .fcm-calendar-header-row {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

.fcm-calendar-day-name {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    display: block !important;
    list-style: none !important;
}

.fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    grid-auto-flow: column !important;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Even more specific for Twenty Twenty-Five */
.fcm-reservations-calendar .fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

div.fcm-calendar-grid > div.fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

.fcm-calendar-week:last-child {
    border-bottom: none;
}

.fcm-calendar-day {
    min-height: 100px;
    padding: 8px;
    border-right: 1px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    display: block !important;
    list-style: none !important;
    margin: 0 !important;
}

/* Ensure day cells don't collapse */
.fcm-calendar-week > .fcm-calendar-day {
    display: block !important;
}

.fcm-calendar-day:hover:not(.fcm-calendar-day-empty):not(
        .fcm-calendar-day-past
    ) {
    background: #e3f2fd;
}

.fcm-calendar-day:last-child {
    border-right: none;
}

.fcm-calendar-day-empty {
    background: #f5f5f5;
    cursor: default;
}

.fcm-calendar-day-past {
    background: #fafafa;
    cursor: default;
    opacity: 0.6;
}

.fcm-calendar-day-number {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.fcm-calendar-day-reservations {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fcm-reservation-item {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fcm-reservation-own {
    background: #2196f3;
    color: #fff;
}

.fcm-reservation-other {
    background: #ff9800;
    color: #fff;
}

.fcm-reservation-time {
    font-weight: 600;
}

/* Calendar Legend */
.fcm-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.fcm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.fcm-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* List View Specific Styles */
.fcm-reservations-list table {
    width: 100%;
    background: #fff;
}

.fcm-reservation-own-row {
    background: #e3f2fd;
}

.fcm-reservation-form {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #3498db;
}

.fcm-reservation-form h4 {
    margin-top: 0;
    color: #2c3e50;
}

/* ============================================
   Flight Legs
   ============================================ */

.fcm-flight-leg {
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.fcm-leg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.fcm-leg-header h5 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

#fcm-flight-legs-container {
    margin-bottom: 15px;
}

#fcm-add-leg-btn {
    width: 100%;
}

/* ============================================
   My Reservations
   ============================================ */

.fcm-my-reservations h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* ============================================
   My Flights
   ============================================ */

.fcm-my-flights h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* ============================================
   My Invoices
   ============================================ */

.fcm-my-invoices h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* ============================================
   Loading Overlay
   ============================================ */

.fcm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.fcm-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: fcm-spin 1s linear infinite;
}

@keyframes fcm-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .fcm-form-row {
        flex-direction: column;
        gap: 0;
    }

    .fcm-form-actions {
        flex-direction: column;
    }

    .fcm-button {
        width: 100%;
    }

    .fcm-table {
        font-size: 12px;
    }

    .fcm-table th,
    .fcm-table td {
        padding: 8px;
    }

    /* Stack table on mobile */
    .fcm-table thead {
        display: none;
    }

    .fcm-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 4px;
    }

    .fcm-table tbody td {
        display: block;
        text-align: right;
        padding: 10px;
        border-bottom: 1px solid #eee;
    }

    .fcm-table tbody td:before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
    }

    .fcm-table tbody td:last-child {
        border-bottom: none;
    }

    /* Calendar responsive adjustments */
    .fcm-calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .fcm-aircraft-selector {
        width: 100%;
    }

    .fcm-view-toggle {
        width: 100%;
    }

    .fcm-view-btn {
        flex: 1;
    }

    .fcm-calendar-navigation {
        flex-wrap: wrap;
        gap: 10px;
    }

    .fcm-month-label {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }

    .fcm-calendar-day {
        min-height: 70px;
        padding: 4px;
        font-size: 12px;
    }

    .fcm-calendar-day-number {
        font-size: 11px;
    }

    .fcm-reservation-item {
        font-size: 9px;
        padding: 2px 3px;
    }

    .fcm-calendar-legend {
        flex-wrap: wrap;
        gap: 10px;
    }

    .fcm-legend-item {
        font-size: 12px;
    }

    .fcm-legend-color {
        width: 16px;
        height: 16px;
    }

    /* Ensure grid still works on mobile */
    .fcm-calendar-header-row,
    .fcm-calendar-week,
    div.fcm-reservations-calendar div.fcm-calendar-header-row,
    div.fcm-reservations-calendar div.fcm-calendar-week {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
    }
}

/* Additional Twenty Twenty-Five theme overrides */
.wp-site-blocks .fcm-calendar-header-row,
.wp-site-blocks .fcm-calendar-week,
.entry-content .fcm-calendar-header-row,
.entry-content .fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Force grid on all WordPress block themes */
body .fcm-reservations-calendar .fcm-calendar-grid .fcm-calendar-header-row,
body .fcm-reservations-calendar .fcm-calendar-grid .fcm-calendar-week {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .fcm-button,
    .fcm-form-actions,
    .fcm-calendar-header,
    .fcm-aircraft-selector {
        display: none;
    }

    .fcm-table {
        box-shadow: none;
    }
}
