/* Custom styles for Trainer SMS AI */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Hero section background */
.bg-gradient {
    background: var(--primary-gradient);
}

/* Feature cards */
.feature-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

/* Custom card borders */
.border-left-primary {
    border-left: 4px solid #4e73df !important;
}

.border-left-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-left-info {
    border-left: 4px solid var(--info-color) !important;
}

.border-left-warning {
    border-left: 4px solid var(--warning-color) !important;
}

/* Dashboard stats cards */
.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

/* Sidebar */
.sidebar {
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: #333;
    border-radius: 0.25rem;
    margin: 0.25rem 0;
}

.sidebar .nav-link:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.sidebar .nav-link.active {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    font-weight: 600;
}

/* Message cards */
.message-card {
    border-left: 4px solid #007bff;
    margin-bottom: 1rem;
}

.message-card.outbound {
    border-left-color: var(--success-color);
}

.message-card.inbound {
    border-left-color: var(--info-color);
}

.message-card.failed {
    border-left-color: var(--danger-color);
}

/* Client cards */
.client-card {
    transition: transform 0.2s ease-in-out;
    cursor: pointer;
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.client-streak {
    display: inline-block;
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.status-sent {
    background-color: var(--success-color);
    color: white;
}

.status-delivered {
    background-color: #20c997;
    color: white;
}

.status-failed {
    background-color: var(--danger-color);
    color: white;
}

.status-queued {
    background-color: var(--warning-color);
    color: #212529;
}

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* Form enhancements */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

/* Character counter */
.char-counter {
    font-size: 0.875rem;
    color: #6c757d;
}

.char-counter.warning {
    color: var(--warning-color);
}

.char-counter.danger {
    color: var(--danger-color);
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Show mobile nav toggle */
    .mobile-nav-toggle {
        display: block;
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        z-index: 1045;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        padding-top: 1rem;
        overflow-y: auto;
    }
    
    /* Show sidebar when active */
    .sidebar.show {
        left: 0;
    }
    
    .mobile-sidebar-overlay.show {
        display: block;
    }
    
    /* Adjust main content for mobile */
    .col-md-9.ms-sm-auto.col-lg-10 {
        margin-left: 0 !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Feature cards */
    .feature-card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Dashboard stats cards - stack vertically on mobile */
    .col-xl-3.col-md-6 {
        margin-bottom: 1.5rem;
    }
    
    /* Card enhancements for mobile */
    .card {
        border-radius: 12px;
        border: none;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .card-header {
        padding: 1rem 1.25rem;
        border-radius: 12px 12px 0 0;
        border-bottom: 1px solid #e9ecef;
        font-weight: 600;
    }
    
    /* Client cards mobile optimization */
    .client-card {
        transition: all 0.2s ease;
        cursor: pointer;
        border-radius: 12px;
    }
    
    .client-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    }
    
    /* Message cards */
    .message-card {
        border-radius: 8px;
        border-left-width: 4px;
        margin-bottom: 1rem;
    }
    
    /* Feature cards for home page */
    .feature-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
        text-align: center;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.15);
    }
    
    /* Stats cards content adjustment */
    .border-left-primary,
    .border-left-success,
    .border-left-info,
    .border-left-warning {
        border-left-width: 4px;
        border-radius: 8px;
    }
    
    /* Container adjustments */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Forms and inputs - Mobile optimized */
    .form-control, .form-select, .form-control:focus {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
        min-height: 48px;
        border-radius: 8px;
        border-width: 2px;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
    }
    
    /* Textarea specific */
    textarea.form-control {
        min-height: 100px;
        resize: vertical;
    }
    
    /* Form labels */
    .form-label {
        font-weight: 600;
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Buttons - increase touch target size */
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        border-radius: 8px;
        font-weight: 600;
        border-width: 2px;
    }
    
    .btn-sm {
        min-height: 42px;
        padding: 0.675rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* Form groups spacing */
    .mb-3 {
        margin-bottom: 1.5rem;
    }
    
    /* Error states */
    .is-invalid {
        border-color: #dc3545 !important;
    }
    
    /* Select dropdowns */
    .form-select {
        background-size: 20px;
        padding-right: 3rem;
    }
    
    /* Input groups */
    .input-group > .form-control,
    .input-group > .form-select {
        min-height: 48px;
    }
    
    /* Typography mobile optimization */
    .h1, h1 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        font-weight: 700;
    }
    
    .h2, h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.875rem;
        font-weight: 600;
    }
    
    .h3, h3 {
        font-size: 1.25rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
        font-weight: 600;
    }
    
    .h4, h4, .h5, h5, .h6, h6 {
        font-size: 1.125rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }
    
    /* Body text */
    body {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }
    
    .small, small {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    /* Display text for hero sections */
    .display-4 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1.25rem;
    }
    
    .lead {
        font-size: 1.125rem;
        line-height: 1.5;
        margin-bottom: 1.25rem;
    }
    
    /* Navigation */
    .sidebar .nav-link {
        padding: 1rem;
        font-size: 1.1rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Table responsiveness */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Touch Target Guidelines - Ensure 44x44px minimum */
    .nav-link, .navbar-nav .nav-link {
        min-height: 48px;
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
    }
    
    /* Badge and small interactive elements */
    .badge {
        min-height: 24px;
        padding: 0.375rem 0.75rem;
        display: inline-flex;
        align-items: center;
    }
    
    /* Status badges as clickable elements */
    .status-badge {
        min-height: 28px;
        padding: 0.375rem 0.75rem;
        display: inline-flex;
        align-items: center;
        border-radius: 6px;
    }
    
    /* Tab navigation */
    .nav-pills .nav-link {
        min-height: 48px;
        padding: 0.75rem 1.25rem;
        border-radius: 8px;
    }
    
    /* Interactive cards */
    .client-card, .message-card, .schedule-card {
        min-height: 80px;
        cursor: pointer;
    }
    
    /* Link elements */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        text-decoration: none;
    }
    
    a.text-decoration-none {
        text-decoration: none !important;
    }
    
    /* Icon buttons */
    .btn i, .nav-link i {
        font-size: 1.125rem;
        margin-right: 0.5rem;
    }
    
    /* Alert dismiss buttons */
    .alert .btn-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Calendar day cells */
    .calendar-day {
        min-height: 44px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Dropdown and select elements */
    .dropdown-toggle {
        min-height: 48px;
        padding: 0.75rem 1rem;
    }
}

/* Animation for tab switching */
.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Experiment cards */
.experiment-card {
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.experiment-active {
    border-left: 4px solid var(--success-color);
}

.experiment-inactive {
    border-left: 4px solid #6c757d;
    opacity: 0.7;
}

/* Schedule cards */
.schedule-card {
    border-left: 4px solid var(--info-color);
    margin-bottom: 0.5rem;
}

.schedule-inactive {
    opacity: 0.6;
    border-left-color: #6c757d;
}

/* Calendar Widget Styles */
.calendar-widget {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.calendar-month-year {
    font-weight: 600;
    color: #495057;
    margin: 0 1rem;
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #e9ecef;
}

.calendar-day-label {
    padding: 0.75rem 0.25rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    border-right: 1px solid #dee2e6;
}

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

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #f1f3f4;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 45px;
}

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

.calendar-day:hover {
    background-color: #e3f2fd;
}

.calendar-day.other-month {
    color: #adb5bd;
    background-color: #f8f9fa;
}

.calendar-day.today {
    background-color: #fff3cd;
    font-weight: 600;
    color: #856404;
}

.calendar-day.selected {
    background-color: #0d6efd;
    color: white;
    font-weight: 600;
}

.calendar-day.disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.calendar-day.disabled:hover {
    background-color: #f8f9fa;
}

.calendar-day.has-schedule {
    background-color: #d4edda;
    color: #155724;
}

.calendar-day.has-schedule::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background-color: #28a745;
    border-radius: 50%;
}

.selected-date-info {
    padding: 1rem;
}

/* Schedule Summary */
#scheduleSummary {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* Time picker styling */
#scheduleTime {
    font-size: 1.1rem;
    padding: 0.75rem;
}

/* Modal enhancements */
.modal-lg {
    max-width: 900px;
}

/* Responsive calendar */
@media (max-width: 767px) {
    .calendar-day {
        font-size: 0.875rem;
        min-height: 40px;
    }
    
    .calendar-day-label {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    /* Mobile Modal Optimization */
    .modal-lg {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .modal-dialog {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 12px;
        border: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .modal-header {
        padding: 1.25rem;
        border-radius: 12px 12px 0 0;
        border-bottom: 1px solid #e9ecef;
    }
    
    .modal-body {
        padding: 1.25rem;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem 1.25rem;
        border-top: 1px solid #e9ecef;
        border-radius: 0 0 12px 12px;
    }
    
    .modal-title {
        font-size: 1.25rem;
        font-weight: 600;
    }
    
    /* Modal form elements */
    .modal .form-control,
    .modal .form-select {
        font-size: 16px;
        min-height: 48px;
    }
    
    .modal .btn {
        min-height: 48px;
        font-weight: 600;
    }
    
    /* Modal close button */
    .btn-close {
        font-size: 1.25rem;
        padding: 0.75rem;
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Full-height modals on very small screens */
    @media (max-height: 600px) {
        .modal-dialog {
            height: 100vh;
            max-height: 100vh;
            margin: 0;
            border-radius: 0;
        }
        
        .modal-content {
            height: 100%;
            border-radius: 0;
        }
        
        .modal-body {
            max-height: none;
            flex: 1;
        }
    }
}
