/**
 * MCAST Booking System - Enhanced Responsive Frontend Styles  
 */

/* Base Styles */
.mcast-booking-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.mcast-booking-wrapper * {
    box-sizing: border-box;
}

/* Connection Status - Fixed position top right */
.mcast-connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #4caf50;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 20px);
}

.mcast-connection-status.disconnected { background: #f44336; }
.mcast-connection-status.syncing { background: #ff9800; }

.mcast-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: mcastPulse 2s infinite;
    flex-shrink: 0;
}

@keyframes mcastPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Header */
.mcast-header {
    text-align: center;
    color: #000043;
    margin-bottom: 30px;
}

.mcast-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #000043;
    line-height: 1.2;
}

.mcast-header p {
    font-size: 1.1em;
    opacity: 0.8;
}

/* Stats Dashboard */
.mcast-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mcast-stat-card {
    background: linear-gradient(135deg, #000043 0%, #000066 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,67,0.2);
}

.mcast-stat-card .stat-number {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 5px;
    word-break: break-word;
}

.mcast-stat-card .stat-label {
    font-size: 0.95em;
    opacity: 0.9;
}

/* Form Cards */
.mcast-form-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,67,0.1);
    margin-bottom: 30px;
}

.mcast-form-card h2 {
    color: #000043;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #000043;
    padding-bottom: 10px;
    word-break: break-word;
}

/* Disclaimer Styles */
.mcast-disclaimer {
    background: #fff8e1;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.mcast-disclaimer h3 {
    color: #000043;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.mcast-disclaimer p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.mcast-disclaimer ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.mcast-disclaimer li {
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
    line-height: 1.6;
}

.mcast-disclaimer li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #000043;
    font-weight: bold;
    font-size: 1.2em;
}

.mcast-disclaimer strong {
    color: #000043;
}

.mcast-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.mcast-form-group {
    display: flex;
    flex-direction: column;
}

.mcast-form-group label {
    color: #000043;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.mcast-required {
    color: #d32f2f;
}

.mcast-form-group input,
.mcast-form-group select,
.mcast-form-group textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    font-family: inherit;
    width: 100%;
    min-height: 44px; /* Better touch target */
}

.mcast-form-group input:focus,
.mcast-form-group select:focus,
.mcast-form-group textarea:focus {
    outline: none;
    border-color: #000043;
    box-shadow: 0 0 0 3px rgba(0,0,67,0.1);
}

.mcast-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.mcast-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.mcast-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.mcast-checkbox-group label {
    margin: 0 !important;
    cursor: pointer;
    font-weight: 500 !important;
}

/* Checkbox Grid for Invitees */
.mcast-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

/* Approval Checkbox */
.mcast-approval-checkbox {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 15px !important;
    margin: 20px 0;
}

.mcast-approval-checkbox label {
    font-size: 1.05em !important;
    color: #000043 !important;
}

/* Preference Acknowledgment Checkbox */
.mcast-preference-checkbox {
    background: #fff3e0;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 15px !important;
    margin: 20px 0;
}

.mcast-preference-checkbox label {
    font-size: 1.05em !important;
    color: #000043 !important;
}

.mcast-submit-btn {
    background: #000043;
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
    min-height: 50px; /* Better touch target */
}

.mcast-submit-btn:hover {
    background: #000066;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,67,0.3);
}

.mcast-submit-btn:active {
    transform: translateY(0);
}

.mcast-notice {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    display: none;
}

.mcast-notice.show {
    display: block;
}

/* Booking Items */
.mcast-booking-item {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,67,0.08);
    margin-bottom: 20px;
    border-left: 5px solid #000043;
    transition: all 0.3s;
}

.mcast-booking-item:hover {
    box-shadow: 0 5px 25px rgba(0,0,67,0.15);
    transform: translateY(-2px);
}

.mcast-booking-item h3 {
    color: #000043;
    margin-bottom: 15px;
    font-size: 1.4em;
    word-break: break-word;
}

.mcast-booking-detail {
    margin: 10px 0;
    color: #555;
    line-height: 1.6;
    word-break: break-word;
}

.mcast-booking-detail strong {
    color: #000043;
    font-weight: 600;
}

/* Filter Section */
.mcast-filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.mcast-filter-section h3 {
    color: #000043;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Preview Card */
.mcast-preview-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
    border: 2px solid #e0e0e0;
}

.mcast-preview-card h3 {
    color: #000043;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Empty State */
.mcast-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.mcast-empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.mcast-empty-state p {
    font-size: 1.1em;
}

/* Alert Modal */
.mcast-custom-alert {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
}

.mcast-custom-alert.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mcast-alert-content {
    background: white;
    padding: 0;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    margin: 0 10px;
}

.mcast-alert-header {
    background: #000043;
    color: white;
    padding: 20px;
    font-size: 1.2em;
    font-weight: 600;
}

.mcast-alert-body {
    padding: 30px;
    color: #333;
    font-size: 1.05em;
    line-height: 1.6;
    text-align: center;
}

.mcast-alert-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.mcast-alert-icon.success {
    background: #e8f5e9;
    color: #4caf50;
}

.mcast-alert-icon.error {
    background: #ffebee;
    color: #f44336;
}

.mcast-alert-icon.warning {
    background: #fff3e0;
    color: #ff9800;
}

.mcast-alert-buttons {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    background: #f5f5f5;
    flex-wrap: wrap;
}

.mcast-alert-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px; /* Better touch target */
}

.mcast-alert-btn.primary {
    background: #000043;
    color: white;
}

.mcast-alert-btn.primary:hover {
    background: #000066;
}

.mcast-alert-btn.secondary {
    background: #e0e0e0;
    color: #333;
}

/* Download button in alert */
.mcast-download-btn {
    display: inline-block;
    background: linear-gradient(135deg, #000043 0%, #0d47a1 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 10px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 67, 0.2);
}

.mcast-download-btn:hover {
    background: linear-gradient(135deg, #0d47a1 0%, #000043 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 67, 0.3);
}

.mcast-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 67, 0.2);
}

/* ============================================
   RESPONSIVE DESIGN - MULTI-BREAKPOINT SYSTEM
   ============================================ */

/* Large tablets and small desktops (1024px and below) */
@media (max-width: 1024px) {
    .mcast-booking-wrapper {
        padding: 15px;
    }
    
    .mcast-header h1 {
        font-size: 2.2em;
    }
    
    .mcast-form-card,
    .mcast-disclaimer {
        padding: 25px;
    }
    
    .mcast-stat-card .stat-number {
        font-size: 2.2em;
    }
}

/* Tablets (768px and below) */
@media (max-width: 768px) {
    .mcast-booking-wrapper {
        padding: 10px;
    }
    
    /* Connection status - smaller on mobile */
    .mcast-connection-status {
        padding: 6px 12px;
        font-size: 0.75em;
        top: 5px;
        right: 5px;
    }
    
    .mcast-status-dot {
        width: 6px;
        height: 6px;
    }
    
    /* Header adjustments */
    .mcast-header {
        margin-bottom: 20px;
    }
    
    .mcast-header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .mcast-header p {
        font-size: 0.95em;
    }
    
    /* Stats grid - single column on tablets */
    .mcast-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .mcast-stat-card {
        padding: 20px;
    }
    
    .mcast-stat-card .stat-number {
        font-size: 2em;
    }
    
    .mcast-stat-card .stat-label {
        font-size: 0.9em;
    }
    
    /* Form cards */
    .mcast-form-card,
    .mcast-disclaimer,
    .mcast-filter-section {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .mcast-form-card h2 {
        font-size: 1.5em;
    }
    
    .mcast-disclaimer h3 {
        font-size: 1.2em;
    }
    
    /* Form rows - single column */
    .mcast-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Checkbox grid - 2 columns on tablet */
    .mcast-checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }
    
    /* Booking items */
    .mcast-booking-item {
        padding: 20px;
    }
    
    .mcast-booking-item h3 {
        font-size: 1.2em;
    }
    
    /* Alert modal */
    .mcast-alert-header {
        padding: 15px;
        font-size: 1.1em;
    }
    
    .mcast-alert-body {
        padding: 20px;
        font-size: 1em;
    }
    
    .mcast-alert-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .mcast-alert-buttons {
        padding: 15px;
    }
}

/* Mobile devices (576px and below) */
@media (max-width: 576px) {
    .mcast-booking-wrapper {
        padding: 8px;
    }
    
    /* Connection status - very compact */
    .mcast-connection-status {
        padding: 5px 10px;
        font-size: 0.7em;
        border-radius: 15px;
    }
    
    #mcastStatusText {
        display: none; /* Hide text on very small screens, show only dot */
    }
    
    /* Header */
    .mcast-header {
        margin-bottom: 15px;
    }
    
    .mcast-header h1 {
        font-size: 1.5em;
    }
    
    .mcast-header p {
        font-size: 0.85em;
    }
    
    /* Stats */
    .mcast-stats-grid {
        gap: 10px;
    }
    
    .mcast-stat-card {
        padding: 15px;
    }
    
    .mcast-stat-card .stat-number {
        font-size: 1.8em;
    }
    
    .mcast-stat-card .stat-label {
        font-size: 0.85em;
    }
    
    /* Form elements */
    .mcast-form-card,
    .mcast-disclaimer,
    .mcast-filter-section,
    .mcast-preview-card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 10px;
    }
    
    .mcast-form-card h2 {
        font-size: 1.3em;
        padding-bottom: 8px;
    }
    
    .mcast-disclaimer {
        padding: 15px;
    }
    
    .mcast-disclaimer h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .mcast-disclaimer li {
        padding-left: 20px;
        font-size: 0.9em;
    }
    
    .mcast-disclaimer p {
        font-size: 0.9em;
    }
    
    /* Form inputs - larger for better mobile usability */
    .mcast-form-group {
        margin-bottom: 15px;
    }
    
    .mcast-form-group label {
        font-size: 0.9em;
        margin-bottom: 6px;
    }
    
    .mcast-form-group input,
    .mcast-form-group select,
    .mcast-form-group textarea {
        padding: 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px; /* iOS recommended touch target */
    }
    
    /* Checkbox grid - single column on mobile */
    .mcast-checkbox-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
    
    .mcast-checkbox-group {
        padding: 8px 0;
    }
    
    .mcast-checkbox-group input[type="checkbox"] {
        width: 24px; /* Larger touch target */
        height: 24px;
    }
    
    .mcast-checkbox-group label {
        font-size: 0.9em;
    }
    
    /* Approval checkbox */
    .mcast-approval-checkbox {
        padding: 12px !important;
    }
    
    .mcast-approval-checkbox label {
        font-size: 0.95em !important;
    }
    
    /* Preference checkbox */
    .mcast-preference-checkbox {
        padding: 12px !important;
    }
    
    .mcast-preference-checkbox label {
        font-size: 0.95em !important;
    }
    
    /* Submit button */
    .mcast-submit-btn {
        padding: 16px 30px;
        font-size: 1em;
        min-height: 52px;
    }
    
    /* Booking items */
    .mcast-booking-item {
        padding: 15px;
    }
    
    .mcast-booking-item h3 {
        font-size: 1.1em;
    }
    
    .mcast-booking-detail {
        font-size: 0.9em;
    }
    
    /* Alert modal - full width on mobile */
    .mcast-alert-content {
        width: 95%;
        margin: 0 5px;
    }
    
    .mcast-alert-header {
        padding: 12px 15px;
        font-size: 1em;
    }
    
    .mcast-alert-body {
        padding: 15px;
        font-size: 0.95em;
    }
    
    .mcast-alert-icon {
        width: 45px;
        height: 45px;
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .mcast-alert-buttons {
        padding: 12px;
        gap: 8px;
    }
    
    .mcast-alert-btn {
        padding: 12px 20px;
        font-size: 0.95em;
        flex: 1;
        min-width: 120px;
    }
    
    /* Filter section */
    .mcast-filter-section h3 {
        font-size: 1.1em;
    }
    
    /* Preview card */
    .mcast-preview-card {
        padding: 15px;
    }
    
    .mcast-preview-card h3 {
        font-size: 1.05em;
    }
    
    /* Empty state */
    .mcast-empty-state {
        padding: 40px 15px;
    }
    
    .mcast-empty-state svg {
        width: 60px;
        height: 60px;
    }
    
    .mcast-empty-state p {
        font-size: 1em;
    }
}

/* Extra small devices (400px and below) */
@media (max-width: 400px) {
    .mcast-header h1 {
        font-size: 1.3em;
    }
    
    .mcast-stat-card .stat-number {
        font-size: 1.6em;
    }
    
    .mcast-form-card h2 {
        font-size: 1.2em;
    }
    
    .mcast-disclaimer h3,
    .mcast-preview-card h3,
    .mcast-filter-section h3 {
        font-size: 1em;
    }
    
    .mcast-booking-item h3 {
        font-size: 1em;
    }
    
    .mcast-alert-content {
        width: 98%;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mcast-header {
        margin-bottom: 10px;
    }
    
    .mcast-header h1 {
        font-size: 1.5em;
    }
    
    .mcast-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .mcast-stat-card {
        padding: 12px;
    }
    
    .mcast-stat-card .stat-number {
        font-size: 1.5em;
    }
    
    .mcast-form-card,
    .mcast-disclaimer {
        padding: 15px;
    }
}

/* High DPI screens - better rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .mcast-form-group input,
    .mcast-form-group select,
    .mcast-form-group textarea {
        border-width: 1px;
    }
    
    .mcast-form-group input:focus,
    .mcast-form-group select:focus,
    .mcast-form-group textarea:focus {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .mcast-connection-status,
    .mcast-submit-btn,
    .mcast-custom-alert {
        display: none !important;
    }
    
    .mcast-booking-wrapper {
        padding: 0;
    }
    
    .mcast-form-card,
    .mcast-booking-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
