/**
 * File: dashboard.css
 * Path: /wp-content/plugins/family-dashboard/assets/css/dashboard.css
 * 
 * FIXED: Events now properly span multiple hours with precise positioning and sizing
 * Key changes:
 * - Time slots container uses relative positioning
 * - Events use absolute positioning relative to the entire time slots container
 * - Event height and position calculated based on precise start/end times
 * - Events can now span multiple hour boundaries seamlessly
 */

/* Reset & Base Styles */
.fd-dashboard {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    padding: 0;
    margin: 0;
}

/* Fullscreen Prompt */
.fd-fullscreen-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.fd-fullscreen-prompt-content {
    background: white;
    border-radius: 24px;
    padding: 48px;
    text-align: center;
    max-width: 500px;
    margin: 20px;
}

.fd-prompt-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.fd-fullscreen-prompt h2 {
    font-size: 32px;
    margin: 0 0 16px 0;
    color: #1a1a1a;
}

.fd-fullscreen-prompt p {
    font-size: 18px;
    color: #666;
    margin: 0 0 32px 0;
}

.fd-fullscreen-prompt .fd-btn-primary {
    margin-bottom: 16px;
}

.fd-fullscreen-prompt.fd-hidden {
    display: none;
}

/* Login Styles */
.fd-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.fd-login-box {
    background: white;
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.fd-login-header {
    text-align: center;
    margin-bottom: 32px;
}

.fd-login-header h1 {
    font-size: 36px;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    font-weight: 700;
}

.fd-login-header p {
    color: #666;
    margin: 0;
    font-size: 16px;
}

.fd-form-group {
    margin-bottom: 24px;
}

.fd-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 18px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.fd-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.fd-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 16px;
}

.fd-checkbox input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.fd-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.fd-btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.fd-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

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

.fd-error-message {
    background: #fee;
    color: #c33;
    padding: 14px;
    border-radius: 12px;
    margin-top: 16px;
    text-align: center;
    font-weight: 500;
}

/* Dashboard Header */
.fd-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.fd-header-left h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    color: #1a1a1a;
    font-weight: 700;
}

.fd-header-left p {
    margin: 0;
    font-size: 20px;
    color: #666;
    font-weight: 500;
}

.fd-header-right {
    display: flex;
    gap: 12px;
}

.fd-btn-icon {
    width: 48px;
    height: 48px;
    border: none;
    background: #f5f5f5;
    border-radius: 12px;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s;
}

.fd-btn-icon:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.fd-btn-icon.fd-spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dashboard Content */
.fd-dashboard-content {
    padding: 24px;
}

/* Widgets */
.fd-widget {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.fd-widget-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fd-widget-header h2,
.fd-widget-header h3 {
    margin: 0;
    font-size: 24px;
    color: #1a1a1a;
    font-weight: 700;
}

.fd-widget-body {
    padding: 24px;
}

/* View Switcher */
.fd-view-switcher {
    display: flex;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
}

.fd-view-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.fd-view-btn.fd-view-active {
    background: white;
    color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fd-view-btn:hover:not(.fd-view-active) {
    background: rgba(255,255,255,0.7);
    color: #1a1a1a;
}

/* Calendar Navigation */
.fd-calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fd-calendar-nav .fd-btn-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

.fd-btn-text {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.fd-btn-text:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

#fd-week-display {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 18px;
    min-width: 180px;
    text-align: center;
}

/* FIXED: Time-Slot Day View with proper absolute positioning */
.fd-day-planner {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fd-planner-header {
    display: grid;
    grid-template-columns: 120px repeat(auto-fit, minmax(200px, 1fr));
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
}

.fd-time-header {
    padding: 20px 16px;
    font-weight: 700;
    color: #495057;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fd-member-header {
    padding: 16px;
    text-align: center;
    border-right: 1px solid #dee2e6;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.fd-member-header:last-child {
    border-right: none;
}

.fd-member-avatar-small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
    font-weight: bold;
    font-size: 20px;
    background: #667eea;
}

.fd-member-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fd-member-header h4 {
    margin: 0;
    font-size: 16px;
    color: #1a1a1a;
}

.fd-calendar-indicators-small {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.fd-calendar-dot-small {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* All-day Events Section */
.fd-allday-section {
    display: grid;
    grid-template-columns: 120px repeat(auto-fit, minmax(200px, 1fr));
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
}

.fd-time-label {
    padding: 12px 16px;
    font-weight: 600;
    color: #6c757d;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.fd-member-allday {
    padding: 8px 12px;
    border-right: 1px solid #dee2e6;
    background: white;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fd-member-allday:last-child {
    border-right: none;
}

.fd-allday-placeholder {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-style: italic;
    font-size: 14px;
}

.fd-allday-event {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.3;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.fd-allday-event:hover {
    transform: translateY(-1px);
}

.fd-allday-event .fd-event-title {
    font-weight: 600;
    display: block;
}

.fd-allday-event .fd-event-location {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 2px;
    display: block;
}

/* CRITICAL FIX: Time Slots Container - Allows absolute positioning of events */
.fd-time-slots {
    position: relative; /* KEY: This allows absolute positioning within */
    display: flex;
    flex-direction: column;
    background: white;
}

.fd-time-row {
    display: grid;
    grid-template-columns: 120px repeat(auto-fit, minmax(200px, 1fr));
    height: 80px; /* Fixed height for calculations */
    position: relative;
    border-bottom: 1px solid #f1f3f5;
}

.fd-time-row:last-child {
    border-bottom: none;
}

.fd-time-row .fd-time-label {
    height: 80px;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    position: relative;
    z-index: 3;
}

/* Half-hour line indicators */
.fd-time-row[data-time-slot]:not([data-time-slot="early"]):not([data-time-slot="late"])::after {
    content: '';
    position: absolute;
    top: 40px; /* Half way through 80px row */
    left: 120px;
    right: 0;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #e9ecef,
        #e9ecef 4px,
        transparent 4px,
        transparent 8px
    );
    z-index: 1;
    pointer-events: none;
}

/* CRITICAL FIX: Time slot containers for click detection */
.fd-time-slot {
    height: 80px;
    border-right: 1px solid #f1f3f5;
    background: white;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* REMOVED: overflow: hidden - this was constraining events */
}

.fd-time-slot:last-child {
    border-right: none;
}

.fd-time-slot:hover {
    background: #f8f9fa;
}

.fd-time-slot:active,
.fd-time-slot.fd-long-press {
    background: #e3f2fd;
    transform: scale(0.98);
}

.fd-time-slot-empty {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 24px;
    opacity: 0.3;
    pointer-events: none;
}

.fd-time-slot-empty::before {
    content: '+';
}

/* CRITICAL FIX: Events positioned absolutely within time-slots container */
.fd-time-event {
    position: absolute;
    left: 4px;
    right: 4px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 20;
    overflow: hidden;
    box-sizing: border-box;
    pointer-events: auto;
    /* Height and top are now set dynamically via JavaScript */
}

.fd-time-event:hover {
    transform: translateX(2px);
    z-index: 21;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.fd-time-event .fd-event-time {
    font-weight: 600;
    font-size: 11px;
    margin-bottom: 2px;
    display: block;
    opacity: 0.9;
}

.fd-time-event .fd-event-title {
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Allow multiple lines for long events */
    white-space: normal;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    display: -webkit-box;
}

.fd-time-event .fd-event-location {
    font-size: 10px;
    opacity: 0.8;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Multiple events stacking - adjusted for absolute positioning */
.fd-time-slot .fd-time-event:nth-child(2) {
    transform: translateX(8px);
    z-index: 22;
    width: calc(100% - 12px);
}

.fd-time-slot .fd-time-event:nth-child(3) {
    transform: translateX(16px);
    z-index: 23;
    width: calc(100% - 20px);
}

.fd-time-slot .fd-time-event:nth-child(4) {
    transform: translateX(24px);
    z-index: 24;
    width: calc(100% - 28px);
}

/* Original Week View Styles */
.fd-family-planner {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
}

.fd-member-column {
    flex: 1;
    min-width: 220px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.fd-member-column:hover {
    transform: translateY(-2px);
}

.fd-member-column-header {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.fd-member-column-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: white;
    font-size: 32px;
    font-weight: bold;
    background: #667eea;
}

.fd-member-column-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fd-member-column-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #1a1a1a;
}

.fd-calendar-indicators {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.fd-calendar-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.fd-member-column-body {
    padding: 0;
}

/* Enhanced Day Sections */
.fd-day-section {
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 16px;
    min-height: 80px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.fd-day-section:last-child {
    border-bottom: none;
}

.fd-day-section.fd-today {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
}

.fd-day-section:hover {
    background: #f8f9fa;
}

.fd-day-section:active,
.fd-day-section.fd-long-press {
    background: #e3f2fd;
    transform: scale(0.98);
}

.fd-day-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}

.fd-day-name {
    text-transform: uppercase;
    font-size: 12px;
    color: #666;
}

.fd-day-date {
    font-size: 18px;
    color: #1a1a1a;
}

.fd-day-section.fd-today .fd-day-label {
    color: #667eea;
}

/* Enhanced Events List */
.fd-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fd-event-compact {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.3;
    position: relative;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.fd-event-compact:hover {
    transform: translateX(4px);
}

.fd-event-compact:active {
    transform: scale(0.95);
}

.fd-event-time {
    font-weight: 600;
    margin-bottom: 2px;
    display: block;
    font-size: 12px;
    opacity: 0.9;
}

.fd-event-title {
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.fd-event-location {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

.fd-no-events-small {
    color: #ccc;
    font-size: 18px;
    text-align: center;
    margin: 8px 0;
    opacity: 0.5;
}

/* Month View Placeholder */
.fd-month-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.fd-month-placeholder {
    text-align: center;
    padding: 60px 20px;
}

.fd-month-placeholder .fd-placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.fd-month-placeholder h3 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 24px;
}

.fd-month-placeholder p {
    color: #646970;
    font-size: 16px;
    margin: 0;
}

/* Touch-Friendly Modal */
.fd-touch-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fd-event-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #eee;
}

.fd-modal-header h3 {
    margin: 0;
    font-size: 24px;
    color: #1a1a1a;
}

.fd-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fd-modal-close:hover {
    background: #f5f5f5;
    color: #666;
}

/* Touch-Friendly Form Elements */
.fd-touch-form {
    padding: 20px 24px 24px 24px;
}

.fd-form-group {
    margin-bottom: 20px;
}

.fd-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.fd-form-group.fd-half {
    flex: 1;
    margin-bottom: 0;
}

.fd-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-size: 16px;
}

.fd-touch-input,
.fd-touch-select,
.fd-touch-textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 18px;
    transition: all 0.3s;
    box-sizing: border-box;
    background: white;
    -webkit-appearance: none;
    appearance: none;
}

.fd-touch-input:focus,
.fd-touch-select:focus,
.fd-touch-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.fd-touch-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
}

.fd-touch-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Custom Checkbox */
.fd-touch-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.fd-checkbox-label {
    position: relative;
    padding-left: 40px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 500;
    color: #1a1a1a;
    display: inline-block;
    line-height: 24px;
}

.fd-checkbox-label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    transition: all 0.3s;
}

.fd-touch-checkbox:checked + .fd-checkbox-label:before {
    background: #667eea;
    border-color: #667eea;
}

.fd-checkbox-label:after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s;
}

.fd-touch-checkbox:checked + .fd-checkbox-label:after {
    opacity: 1;
}

/* Modal Footer */
.fd-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px 24px 24px;
    border-top: 1px solid #eee;
}

.fd-btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 56px;
    min-width: 120px;
}

.fd-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.fd-btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
}

.fd-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

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

.fd-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Toast Notifications */
#fd-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200000;
    max-width: 400px;
}

.fd-toast {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
    padding: 16px 20px;
    display: none;
    border-left: 4px solid #667eea;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fd-toast-success {
    border-left-color: #10b981;
}

.fd-toast-error {
    border-left-color: #ef4444;
}

.fd-toast-message {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    padding-right: 40px;
}

.fd-toast-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fd-toast-close:hover {
    background: #f5f5f5;
}

/* Error States */
.fd-error {
    color: #ef4444;
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
}

/* Loading States */
.fd-loading-calendar {
    text-align: center;
    padding: 60px 20px;
}

.fd-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.fd-loading-calendar p {
    color: #646970;
    font-size: 16px;
    margin: 0;
}

/* Responsive Touch Optimizations */
@media (max-width: 768px) {
    .fd-dashboard-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }
    
    .fd-family-planner {
        gap: 12px;
        padding: 0 12px;
    }
    
    .fd-member-column {
        min-width: 180px;
    }
    
    .fd-member-column-avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .fd-day-section {
        padding: 10px 12px;
        min-height: 70px;
    }
    
    .fd-event-modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .fd-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .fd-form-group.fd-half {
        margin-bottom: 20px;
    }
    
    .fd-modal-footer {
        flex-direction: column;
    }
    
    .fd-btn {
        width: 100%;
    }
    
    #fd-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .fd-day-planner {
        overflow-x: auto;
    }
    
    .fd-planner-header {
        grid-template-columns: 80px repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .fd-allday-section {
        grid-template-columns: 80px repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .fd-time-row {
        grid-template-columns: 80px repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .fd-time-row[data-time-slot]:not([data-time-slot="early"]):not([data-time-slot="late"])::after {
        left: 80px;
    }
    
    .fd-time-header,
    .fd-time-label {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .fd-member-header {
        padding: 8px;
    }
    
    .fd-member-avatar-small {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .fd-member-header h4 {
        font-size: 14px;
    }
    
    .fd-time-slot {
        min-height: 60px;
        padding: 2px 4px;
    }
    
    .fd-time-event {
        font-size: 11px;
        padding: 4px 6px;
    }
    
    .fd-allday-event {
        font-size: 12px;
        padding: 4px 6px;
    }
    
    .fd-view-switcher {
        flex-direction: column;
        gap: 4px;
    }
    
    .fd-view-btn {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    #fd-week-display {
        font-size: 16px;
        min-width: 140px;
    }
}

/* Tablet Portrait Optimizations */
@media (max-width: 1024px) and (orientation: portrait) {
    .fd-family-planner {
        flex-direction: column;
        gap: 16px;
    }
    
    .fd-member-column {
        min-width: auto;
    }
    
    .fd-member-column-header {
        display: flex;
        align-items: center;
        gap: 16px;
        text-align: left;
        padding: 16px 20px;
    }
    
    .fd-member-column-avatar {
        width: 60px;
        height: 60px;
        margin: 0;
        font-size: 24px;
    }
    
    .fd-calendar-indicators {
        justify-content: flex-start;
        margin-top: 4px;
    }
    
    .fd-member-column-body {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
        background: #eee;
    }
    
    .fd-day-section {
        background: white;
        border-bottom: none;
        border-right: 1px solid #eee;
        min-height: 120px;
    }
    
    .fd-day-section:last-child {
        border-right: none;
    }
    
    .fd-day-planner {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100vh;
        height: 100vw;
        position: absolute;
        top: 50%;
        left: 50%;
        margin-left: -50vh;
        margin-top: -50vw;
    }
    
    .fd-rotate-notice {
        display: block;
        text-align: center;
        padding: 40px 20px;
        font-size: 18px;
        color: #666;
    }
}

/* Tablet Landscape Optimizations */
@media (min-width: 1024px) and (orientation: landscape) {
    .fd-dashboard-content {
        padding: 32px;
    }
    
    .fd-widget-header h2,
    .fd-widget-header h3 {
        font-size: 28px;
    }
    
    .fd-event-title {
        font-size: 16px;
    }
    
    .fd-event-time,
    .fd-event-location {
        font-size: 14px;
    }
    
    .fd-family-planner {
        gap: 24px;
    }
    
    .fd-member-column {
        min-width: 240px;
    }
    
    .fd-planner-header {
        grid-template-columns: 140px repeat(auto-fit, minmax(220px, 1fr));
    }
    
    .fd-allday-section {
        grid-template-columns: 140px repeat(auto-fit, minmax(220px, 1fr));
    }
    
    .fd-time-row {
        grid-template-columns: 140px repeat(auto-fit, minmax(220px, 1fr));
    }
    
    .fd-time-row[data-time-slot]:not([data-time-slot="early"]):not([data-time-slot="late"])::after {
        left: 140px;
    }
    
    .fd-time-slot {
        min-height: 90px;
        padding: 6px 10px;
    }
    
    .fd-time-event {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .fd-member-avatar-small {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* High DPI / Retina Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .fd-event-compact {
        border-width: 2px;
    }
    
    .fd-calendar-dot {
        border-width: 1px;
    }
    
    .fd-calendar-dot-small {
        border-width: 1px;
    }
    
    .fd-time-event {
        border-width: 2px;
    }
    
    .fd-allday-event {
        border-width: 2px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .fd-dashboard {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d3748 100%);
    }
    
    .fd-widget {
        background: #2d3748;
        color: white;
    }
    
    .fd-dashboard-header {
        background: #2d3748;
        color: white;
    }
    
    .fd-day-planner {
        background: #2d3748;
    }
    
    .fd-planner-header {
        background: #4a5568;
    }
    
    .fd-time-header,
    .fd-time-label {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .fd-member-header {
        background: #2d3748;
        color: white;
    }
    
    .fd-time-slot {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .fd-time-slot:hover {
        background: #4a5568;
    }
    
    .fd-member-allday {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .fd-allday-section {
        background: #4a5568;
    }
    
    .fd-view-switcher {
        background: #4a5568;
    }
    
    .fd-view-btn {
        color: #e2e8f0;
    }
    
    .fd-view-btn.fd-view-active {
        background: #2d3748;
        color: white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .fd-event-compact,
    .fd-time-event,
    .fd-allday-event,
    .fd-time-slot,
    .fd-day-section,
    .fd-member-column {
        transition: none;
    }
    
    .fd-btn,
    .fd-view-btn {
        transition: none;
    }
    
    @keyframes spin {
        to { transform: none; }
    }
    
    @keyframes modalSlideIn {
        from, to {
            transform: none;
            opacity: 1;
        }
    }
    
    @keyframes toastSlideIn {
        from, to {
            transform: none;
            opacity: 1;
        }
    }
}

/* Print Styles */
@media print {
    .fd-dashboard-header,
    .fd-btn-icon,
    .fd-fullscreen-prompt,
    #fd-toast-container,
    .fd-view-switcher,
    .fd-calendar-nav {
        display: none !important;
    }
    
    .fd-dashboard {
        background: white !important;
    }
    
    .fd-widget {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .fd-day-planner {
        background: white !important;
    }
    
    .fd-time-event,
    .fd-allday-event,
    .fd-event-compact {
        background: white !important;
        border: 1px solid #ddd !important;
        color: black !important;
    }
}

/* Custom Scrollbars for time-slot view */
.fd-day-planner::-webkit-scrollbar {
    height: 8px;
}

.fd-day-planner::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.fd-day-planner::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.fd-day-planner::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Accessibility improvements */
.fd-time-slot:focus,
.fd-day-section:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.fd-view-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.fd-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}