/* Mobile Optimizations for Work Accident Calculator */

/* Touch-friendly interactions */
@media (max-width: 768px) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 8px 12px;
    }
    
    /* Better form controls */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .form-control-sm {
        min-height: 38px;
        font-size: 14px;
    }
    
    .form-control-lg {
        min-height: 48px;
        font-size: 18px;
    }
    
    /* Better spacing for mobile */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Sticky submit button on mobile */
    .mobile-sticky-submit {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        margin: 0 -15px;
        z-index: 100;
    }
    
    /* Better modal sizing */
    .modal-dialog {
        margin: 10px;
    }
    
    /* Improved text readability */
    .small {
        font-size: 0.825rem;
    }
    
    /* Better card spacing */
    .card-body {
        padding: 1rem;
    }
    
    /* Responsive tables */
    .table-responsive {
        border: none;
    }
    
    /* Better alert styling */
    .alert {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }
    
    /* Improved form labels */
    .form-label {
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    /* Better period card styling */
    .period-item .card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .period-item .card-body {
        padding: 0.75rem;
    }
}

/* Very small screens (phones in portrait) */
@media (max-width: 576px) {
    .display-6 {
        font-size: 1.75rem;
    }
    
    .fs-5 {
        font-size: 1rem !important;
    }
    
    .fs-6 {
        font-size: 0.9rem !important;
    }
    
    /* Stack form elements */
    .row > .col-12 {
        margin-bottom: 0.75rem;
    }
    
    /* Better button styling */
    .btn-lg {
        font-size: 1.1rem;
        padding: 0.75rem 1.5rem;
    }
    
    /* Compact results display */
    .card-header h3,
    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Better number display */
    .text-success h3,
    .text-success h4 {
        font-size: 1.5rem;
    }
    
    .text-primary h4,
    .text-info h4 {
        font-size: 1.25rem;
    }
}

/* Landscape phones and small tablets */
@media (min-width: 576px) and (max-width: 768px) {
    .container {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
}

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

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better period removal button */
.remove-period-btn {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-specific animations */
@media (max-width: 768px) {
    .card {
        transition: transform 0.2s ease;
    }
    
    .period-item {
        animation: slideIn 0.3s ease;
    }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Print styles */
@media print {
    .btn,
    .alert,
    #addPeriodBtn,
    .remove-period-btn {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
    
    .card-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
}

/* AI Assistant Styles */
.ai-assistant-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.ai-assistant-float .btn {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    padding: 0;
    border-radius: 50% !important;
    box-sizing: border-box;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

/* Proactive Help Bubble */
.proactive-help-bubble {
    position: fixed;
    bottom: 100px;
    right: 20px;
    max-width: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1049;
    animation: slideInFromRight 0.5s ease-out, gentlePulse 3s ease-in-out infinite 1s;
    border: 2px solid #0d6efd;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes gentlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 10px 30px rgba(13, 110, 253, 0.3);
    }
}

.bubble-content {
    padding: 0;
}

.bubble-header {
    display: flex;
    align-items: center;
    padding: 12px 16px 8px 16px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    border-radius: 13px 13px 0 0;
}

.bubble-header .text-primary {
    color: white !important;
}

.bubble-body {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.bubble-actions {
    padding: 8px 16px 16px 16px;
    display: flex;
    gap: 8px;
}

.btn-close-sm {
    font-size: 0.75rem;
    padding: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    opacity: 0.8;
}

.btn-close-sm:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
}

/* Bubble arrow pointing to the robot button */
.proactive-help-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #0d6efd;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Chat Interface */
.chat-messages {
    padding: 1rem;
    background: #f8f9fa;
}

.message {
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

.message-content {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background: #007bff;
    color: white;
    margin-left: 2rem;
}

.assistant-message .message-content {
    background: white;
    margin-right: 2rem;
}

.message-time {
    margin-top: 0.25rem;
    padding-left: 1rem;
}

.chat-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #e9ecef;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Auto-filled form fields */
.form-control[style*="background-color: rgb(232, 245, 232)"] {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Suggestion buttons */
.suggestion-buttons {
    animation: slideInFromLeft 0.4s ease-out;
    border-left: 4px solid #007bff;
    margin: 1rem 0;
}

.suggestion-btn {
    transition: all 0.2s ease;
    border-radius: 20px !important;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

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

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* GDPR Cookies Banner Styles */
.cookies-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    z-index: 9999;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUpFromBottom 0.5s ease-out;
}

.cookies-content {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.cookies-icon {
    font-size: 2rem;
    color: #f39c12;
    flex-shrink: 0;
}

.cookies-text {
    flex: 1;
}

.cookies-text h6 {
    margin: 0 0 0.5rem 0;
    color: #ecf0f1;
}

.cookies-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.cookies-text a {
    color: #3498db;
    text-decoration: none;
}

.cookies-text a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.cookies-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

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

/* Mobile responsiveness for cookies banner */
@media (max-width: 768px) {
    .cookies-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .cookies-text {
        order: 1;
    }
    
    .cookies-icon {
        order: 0;
        font-size: 1.5rem;
    }
    
    .cookies-buttons {
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .cookies-text p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .cookies-banner {
        padding: 0.75rem;
    }
    
    .cookies-buttons .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Cookies policy modal enhancements */
.modal-body h6 {
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.modal-body h6:first-child {
    margin-top: 0;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
}

.form-check-label strong {
    color: #2c3e50;
}

.form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.form-check-input:disabled {
    opacity: 0.7;
}

/* Additional animations for cookie interactions */
.cookies-banner.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

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