/* Unified Visual Theme for LottoMuse */
/* This file ensures consistent theming across all pages and components */

/* Apply unified theme to navbar components */
.navbar-nav .nav-link {
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
    margin: 0 4px;
    padding: 8px 16px !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Apply unified theme to dropdown menus */
.dropdown-menu {
    border: 1px solid var(--border-enhanced);
    border-radius: var(--radius);
    box-shadow: var(--shadow-medium);
    padding: 8px 0;
}

.dropdown-item {
    transition: all var(--transition-fast);
    padding: 10px 20px;
    border-radius: 0;
}

.dropdown-item:hover {
    background: var(--gradient-accent);
    color: white;
    transform: translateX(4px);
}

/* Apply unified theme to tables */
.table {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.table th {
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    border: none;
    padding: 16px;
}

.table td {
    padding: 12px 16px;
    border-color: var(--border-subtle);
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
    background-color: rgba(91, 62, 144, 0.05);
}

/* Apply unified theme to modals */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 20px;
}

/* Apply unified theme to alerts */
.alert {
    border: none;
    border-radius: var(--radius);
    border-left: 4px solid;
    box-shadow: var(--shadow-light);
}

.alert-primary {
    background-color: rgba(91, 62, 144, 0.1);
    border-left-color: var(--primary-purple);
    color: var(--primary-purple);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left-color: #28a745;
    color: #155724;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
    color: #856404;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left-color: #dc3545;
    color: #721c24;
}

/* Apply unified theme to pagination */
.pagination .page-link {
    border: 1px solid var(--border-subtle);
    color: var(--primary-purple);
    transition: all var(--transition-fast);
    margin: 0 2px;
    border-radius: var(--radius-sm);
}

.pagination .page-link:hover {
    background: var(--gradient-accent);
    border-color: transparent;
    color: white;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: transparent;
}

/* Apply unified theme to badges */
.badge {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 6px 12px;
}

.badge-primary {
    background: var(--gradient-primary);
}

.badge-secondary {
    background: var(--gradient-accent);
}

/* Apply unified theme to progress bars */
.progress {
    border-radius: var(--radius);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: var(--gradient-accent);
    transition: width var(--transition-smooth);
}

/* Apply unified theme to list groups */
.list-group {
    border-radius: var(--radius);
    box-shadow: var(--shadow-light);
}

.list-group-item {
    border-color: var(--border-subtle);
    transition: all var(--transition-fast);
}

.list-group-item:hover {
    background-color: rgba(91, 62, 144, 0.05);
    transform: translateX(4px);
}

.list-group-item.active {
    background: var(--gradient-primary);
    border-color: transparent;
}

/* Apply unified theme to tooltips */
.tooltip .tooltip-inner {
    background: rgba(0, 0, 0, 0.9);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 8px 12px;
}

/* Global focus styles */
*:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Unified animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Enhanced scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(91, 62, 144, 0.1);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-accent);
    border-radius: var(--radius);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-primary);
}

/* Responsive typography */
@media (max-width: 768px) {
    .h1, h1 { font-size: 2rem; }
    .h2, h2 { font-size: 1.75rem; }
    .h3, h3 { font-size: 1.5rem; }
    .h4, h4 { font-size: 1.25rem; }
    .h5, h5 { font-size: 1.1rem; }
    .h6, h6 { font-size: 1rem; }
}

/* Print styles */
@media print {
    .no-print { display: none !important; }
    .sidebar, .navbar, .floating-chat-input { display: none !important; }
    .chat-container { margin-left: 0 !important; }
}

/* Theme Selection Styles */
.theme-categories h5 {
    color: var(--primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.theme-option {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: 1px solid var(--border-light);
}

.theme-option:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.theme-option.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: var(--primary);
}

.theme-option.btn-outline-secondary:hover {
    background: linear-gradient(135deg, var(--secondary) 0%, #6c757d 100%);
    border-color: var(--secondary);
}

.theme-option.btn-outline-success:hover {
    background: linear-gradient(135deg, var(--success) 0%, #20c997 100%);
    border-color: var(--success);
}

.custom-theme-input {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.custom-theme-input h5 {
    color: var(--accent);
    margin-bottom: 12px;
}

#current-theme {
    background-color: var(--background-light);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

#change-theme-btn {
    white-space: nowrap;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Theme display in chat subtitle */
.chat-subtitle {
    transition: all var(--transition-normal);
}

.chat-subtitle:has-text {
    color: var(--primary);
    font-weight: 500;
}

/* =================================================================
   MOBILE RESPONSIVENESS ENHANCEMENTS
   ================================================================= */

/* Enhanced mobile support for theme selection modal */
@media (max-width: 768px) {
    /* Theme Selection Modal Mobile Optimizations */
    #themeSelectionModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #themeSelectionModal .modal-content {
        border-radius: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #themeSelectionModal .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1;
    }
    
    #themeSelectionModal .modal-body {
        padding: 1rem;
    }
    
    #themeSelectionModal .modal-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid var(--border-subtle);
    }
    
    /* Theme option buttons - mobile friendly */
    .theme-option {
        font-size: 0.875rem !important;
        padding: 0.75rem 1rem !important;
        margin-bottom: 0.75rem !important;
        min-height: 44px; /* Touch-friendly minimum */
        width: 100% !important;
        text-align: left !important;
    }
    
    /* Theme category containers */
    .theme-category {
        margin-bottom: 1.5rem;
    }
    
    .theme-category h5 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--border-subtle);
    }
    
    /* Custom theme input mobile styling */
    .custom-theme-input {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .custom-theme-input .input-group {
        flex-direction: column;
    }
    
    .custom-theme-input .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
        border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
        margin-bottom: -1px;
    }
    
    .custom-theme-input .btn {
        border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
        min-height: 44px;
        font-size: 0.875rem !important;
    }
    
    /* Settings modal mobile enhancements */
    #settingsModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #settingsModal .form-group {
        margin-bottom: 1.5rem;
    }
    
    #settingsModal .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
        min-height: 44px;
    }
    
    #settingsModal .btn {
        min-height: 44px;
        font-size: 0.875rem !important;
        padding: 0.75rem 1.5rem !important;
    }
}

@media (max-width: 576px) {
    /* Extra small mobile adjustments */
    #themeSelectionModal .modal-dialog,
    #settingsModal .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    .theme-option {
        font-size: 0.8rem !important;
        padding: 0.65rem 0.875rem !important;
    }
    
    .theme-category h5 {
        font-size: 1rem;
    }
    
    /* Button spacing improvements */
    .modal-footer .btn + .btn {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Enhanced chat input area mobile responsiveness */
@media (max-width: 768px) {
    /* Chat form mobile optimizations */
    .chat-form {
        padding: 0.75rem !important;
        gap: 0.75rem !important;
    }
    
    .input-wrapper {
        width: 100% !important;
    }
    
    .input-wrapper textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
        border-radius: var(--radius) !important;
        min-height: 44px !important;
        resize: none !important;
    }
    
    .char-counter {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Chat suggestions mobile styling */
    .chat-suggestions {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .suggestion-btn {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
        min-height: 40px !important;
        flex: 1 1 auto !important;
        min-width: calc(50% - 0.25rem) !important;
    }
    
    /* Floating chat input mobile positioning */
    #floating-chat-input {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        border-radius: var(--floating-input-radius, 1.5rem) !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    }
}

@media (max-width: 576px) {
    .suggestion-btn {
        min-width: 100% !important;
        margin-bottom: 0.25rem !important;
    }
    
    .chat-form {
        padding: 0.5rem !important;
    }
    
    .input-wrapper textarea {
        font-size: 14px !important;
        padding: 0.65rem 0.875rem !important;
    }
}

/* Enhanced sidebar toggle button mobile accessibility */
@media (max-width: 768px) {
    .lottery-ball-toggle {
        width: 48px !important;
        height: 48px !important;
        left: 1rem !important;
        top: 1rem !important;
        z-index: 1050 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }
    
    .lottery-ball-toggle .lottery-ball-icon {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* Enhanced touch feedback */
    .lottery-ball-toggle:active {
        transform: scale(0.95) !important;
    }
}

/* Enhanced navigation mobile responsiveness */
@media (max-width: 768px) {
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .navbar-toggler {
        padding: 0.5rem 0.75rem !important;
        font-size: 1.125rem !important;
        border: none !important;
        min-height: 44px !important;
    }
    
    .navbar-brand {
        font-size: 1.25rem !important;
        padding: 0.5rem 0 !important;
    }
}

/* Enhanced table mobile responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        border: none !important;
        margin: 0 -0.75rem !important;
    }
    
    .table {
        font-size: 0.875rem !important;
        margin-bottom: 0 !important;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem !important;
        vertical-align: middle !important;
        border: none !important;
        border-bottom: 1px solid var(--border-subtle) !important;
    }
    
    .table th {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.025em !important;
    }
    
    /* Make action buttons touch-friendly */
    .table .btn {
        font-size: 0.75rem !important;
        padding: 0.375rem 0.75rem !important;
        min-height: 32px !important;
    }
}

/* Enhanced alert mobile responsiveness */
@media (max-width: 768px) {
    .alert {
        border-radius: var(--radius) !important;
        padding: 1rem !important;
        margin: 0.5rem 0 !important;
        font-size: 0.875rem !important;
    }
    
    .alert-dismissible .btn-close {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
    }
}

/* Enhanced form control mobile accessibility */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
        border-radius: var(--radius) !important;
        min-height: 44px !important;
    }
    
    .form-label {
        font-size: 0.875rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
    }
    
    .form-text {
        font-size: 0.75rem !important;
        margin-top: 0.25rem !important;
    }
    
    /* Enhanced button touch targets */
    .btn {
        min-height: 44px !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
        border-radius: var(--radius) !important;
    }
    
    .btn-sm {
        min-height: 38px !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.8rem !important;
    }
    
    .btn-lg {
        min-height: 52px !important;
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
    }
}

/* Enhanced card mobile layout */
@media (max-width: 768px) {
    .card {
        border-radius: 1rem !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .card-header {
        padding: 1rem !important;
        border-radius: 1rem 1rem 0 0 !important;
        font-size: 0.875rem !important;
        font-weight: 600 !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-footer {
        padding: 1rem !important;
        border-radius: 0 0 1rem 1rem !important;
        font-size: 0.875rem !important;
    }
}

/* Fix text overflow and readability on mobile */
@media (max-width: 768px) {
    h1, .h1 { font-size: 2rem !important; line-height: 1.2 !important; }
    h2, .h2 { font-size: 1.75rem !important; line-height: 1.3 !important; }
    h3, .h3 { font-size: 1.5rem !important; line-height: 1.3 !important; }
    h4, .h4 { font-size: 1.25rem !important; line-height: 1.4 !important; }
    h5, .h5 { font-size: 1.125rem !important; line-height: 1.4 !important; }
    h6, .h6 { font-size: 1rem !important; line-height: 1.4 !important; }
    
    p, .lead {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
    
    small, .small {
        font-size: 0.875rem !important;
    }
    
    /* Prevent text overflow */
    * {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Enhanced accessibility for small screens */
@media (max-width: 576px) {
    /* Increase minimum touch target sizes */
    .btn, .form-control, .form-select,
    .nav-link, .dropdown-item,
    input[type="button"], input[type="submit"], input[type="reset"],
    button, [role="button"] {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Enhanced spacing between interactive elements */
    .btn + .btn,
    .form-group + .form-group,
    .card + .card {
        margin-top: 0.75rem !important;
    }
    
    /* Larger text for better readability */
    body {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    /* Enhanced container padding */
    .container, .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
