/* Split stylesheet composed from modular partials */
@import url('parts/_variables.css');
@import url('parts/_base.css');
@import url('parts/_buttons.css');
@import url('parts/_navigation.css');
@import url('parts/_components.css');
@import url('parts/_utilities.css');
@import url('parts/_dark.css');

/* Essential custom styles only - using Bootstrap defaults */

/* Dropdown improvements */
.dropdown-item {
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 2px 8px;
}
/* Desktop clock display styling */
.clock-display {
    font-size: 4rem; /* Enlarged size for desktop */
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bs-primary);
    color: white;
}

.dropdown-item.active {
    background: var(--bs-primary);
    color: white;
    font-weight: 600;
}

.dropdown-toggle::after {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Z-index management for Bootstrap components */
.navbar {
    z-index: 1030 !important;
}

.navbar .dropdown-menu {
    z-index: 1070 !important;
    position: absolute !important;
}

.modal {
    z-index: 1080;
}

.modal-backdrop {
    z-index: 1075;
}

.tooltip {
    z-index: 1090;
}

.popover {
    z-index: 1085;
}

/* Fix for language dropdown specifically */
.nav-item.dropdown .dropdown-menu {
    z-index: 1070 !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    transform: translateY(0) !important;
}

/* Settings panel and FAB z-index */
.settings-fab {
    z-index: 1040 !important;
}

.quick-settings-panel {
    z-index: 1050 !important;
}

.toast {
    z-index: 1070;
}

/* Stopwatch and Timer Styles */
#stopwatch-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--bs-success);
}

#timer-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--bs-warning);
}

/* Random Number Styles */
.result-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--bs-success);
    text-align: center;
    padding: 25px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(25, 135, 84, 0.3);
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* History item styling */
.history-item {
    background: rgba(255, 255, 255, 0.85);
    padding: 15px;
    margin: 8px 0;
    border-radius: 12px;
    border-left: 4px solid var(--bs-primary);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--bs-dark);
    border: 1px solid rgba(13, 110, 253, 0.2);
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Calendar Styles */
.calendar-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

.calendar-table th {
    background: var(--bs-primary);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 12px 4px;
    font-size: 0.9rem;
    border: none;
}

.calendar-table td {
    border: 1px solid #dee2e6;
    padding: 8px 4px;
    text-align: center;
    vertical-align: middle;
    height: 60px;
    position: relative;
    cursor: pointer;
    background: white;
    transition: background-color 0.2s ease;
}

.calendar-table td:hover {
    background-color: #f8f9fa;
}

.calendar-table td.today {
    background-color: #e7f3ff;
    border-color: var(--bs-primary);
    font-weight: bold;
}

.calendar-table td.other-month {
    color: #6c757d;
    background-color: #f8f9fa;
}

.solar-date {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
    color: #333;
}

.lunar-date {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 2px;
    line-height: 1;
}

.calendar-container {
    padding: 20px;
}

/* Random Wheel Styles */
.wheel-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    perspective: 1000px;
    position: relative;
    padding: 20px;
}

.wheel {
    width: 400px;
    height: 400px;
    border: 4px solid var(--bs-primary);
    border-radius: 50%;
    position: relative;
    background-color: #ffffff;
    transition: transform 3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 
        0 0 0 2px rgba(255, 255, 255, 0.8),
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 15px 35px rgba(0, 0, 0, 0.1);
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
    overflow: hidden;
}

.wheel:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 0 0 2px rgba(255, 255, 255, 0.9),
        0 12px 30px rgba(0, 0, 0, 0.2),
        0 20px 40px rgba(0, 0, 0, 0.15);
}

.wheel-pointer {
    position: absolute;
    bottom: 100%; /* place above wheel */
    left: 50%;
    transform: translate(-50%, 10px); /* slight overlap */
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-bottom: 36px solid var(--bs-danger); /* downward pointing triangle */
    z-index: 15;
    pointer-events: none;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
    animation: pointer-pulse 2s ease-in-out infinite;
}

@keyframes pointer-pulse {
    0%, 100% { transform: translate(-50%, 10px) scale(1); }
    50% { transform: translate(-50%, 10px) scale(1.1); }
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: var(--bs-primary);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    z-index: 20;
    box-shadow: 
        0 0 0 2px rgba(13, 110, 253, 0.3),
        0 4px 12px rgba(0,0,0,0.2);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.wheel-names {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    z-index: 10;
}

.wheel-names svg {
    width: 100%;
    height: 100%;
}

.wheel-names path {
    stroke-width: 2;
    stroke: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.wheel-names text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}

.wheel-section {
    filter: brightness(1.1) contrast(1.1);
}

.wheel-section:hover {
    filter: brightness(1.2) contrast(1.2);
}

.wheel.spinning {
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
}

.wheel-result {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--bs-primary);
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 2px solid rgba(13, 110, 253, 0.3);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.btn-group .btn {
    margin: 5px;
}

/* Alert improvements */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.badge {
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 20px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Names list styling */
.names-list {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    border: 2px solid rgba(13, 110, 253, 0.2);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.names-list .name-item {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(13, 110, 253, 0.3);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    color: var(--bs-dark);
    font-weight: 500;
}

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    margin-left: 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
}

.dark-mode-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Dark mode specific styles for the toggle button */
[data-theme="dark"] .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffd700;
}

[data-theme="dark"] .dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffed4e;
}

[data-theme="dark"] .dark-mode-toggle:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

/* Light mode specific styles for the toggle button */
[data-theme="light"] .dark-mode-toggle,
:root:not([data-theme="dark"]) .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-theme="light"] .dark-mode-toggle:hover,
:root:not([data-theme="dark"]) .dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

[data-theme="light"] .dark-mode-toggle:focus,
:root:not([data-theme="dark"]) .dark-mode-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1070;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    padding: 1rem 0;
}

.cookie-consent-banner.show {
    transform: translateY(0);
}

[data-theme="dark"] .cookie-consent-banner {
    background: rgba(33, 37, 41, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .cookie-consent-content {
        flex-direction: column;
        text-align: center;
    }
}

.cookie-consent-text {
    flex: 1;
    min-width: 300px;
}

.cookie-consent-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-dark);
}

.cookie-consent-message {
    margin: 0;
    font-size: 0.9rem;
    color: var(--bs-secondary);
    line-height: 1.4;
}

.cookie-consent-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .cookie-consent-actions {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-consent-actions .btn {
        flex: 1;
        min-width: 80px;
    }
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .clock-display { 
        font-size: 2rem; 
    }
    .date-display { 
        font-size: 1.2rem; 
    }
    .wheel { 
        width: 300px; 
        height: 300px; 
        border-width: 3px; 
    }
    .wheel-center { 
        width: 40px; 
        height: 40px; 
        font-size: 0.7rem; 
    }
    .wheel-pointer { 
        right: -15px; 
        border-top: 12px solid transparent; 
        border-bottom: 12px solid transparent; 
        border-left: 24px solid var(--bs-danger); 
    }
    .result-display { 
        font-size: 2rem; 
    }
    .calendar-table th,
    .calendar-table td { 
        padding: 4px 1px; 
        height: 45px; 
        font-size: 0.8rem; 
        text-align: center;
        vertical-align: middle;
    }
    .solar-date { 
        font-size: 0.9rem; 
        font-weight: 600;
        line-height: 1.1;
    }
    .lunar-date { 
        font-size: 0.6rem; 
        margin-top: 1px; 
        color: #6c757d;
        line-height: 1;
    }
    .calendar-container { 
        padding: 10px; 
    }
    .calendar-table {
        width: 100%;
        table-layout: fixed;
    }
    .calendar-table th {
        font-size: 0.75rem;
        padding: 8px 2px;
        background: var(--bs-primary);
        color: white;
        border: none;
    }
}

/* Dark mode specific overrides */
[data-theme="dark"] .cookie-consent-title {
    color: var(--custom-text-dark);
}

[data-theme="dark"] .cookie-consent-message {
    color: var(--bs-secondary);
}

/* Cookie Status Toast */
.cookie-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1080;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 300px;
}

.cookie-status.show {
    opacity: 1;
    transform: translateX(0);
}

.cookie-status.declined {
    background: #dc3545;
}

@media (max-width: 480px) {
    .cookie-status {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        text-align: center;
    }
}

[data-theme="dark"] .cookie-status {
    background: #198754;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .cookie-status.declined {
    background: #dc3545;
}

/* Fallback Modal Styles - for when Bootstrap is not available */
.modal.show {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1060 !important;
    overflow: auto !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: #000 !important;
    z-index: 1055 !important;
}

.modal-dialog {
    margin: 1.75rem auto !important;
    max-width: 500px !important;
    position: relative !important;
}

.modal-dialog.modal-lg {
    max-width: 800px !important;
}

.modal-content {
    background-color: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    position: relative !important;
}

.modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1rem 1rem !important;
    border-bottom: 1px solid #dee2e6 !important;
    border-top-left-radius: calc(0.5rem - 1px) !important;
    border-top-right-radius: calc(0.5rem - 1px) !important;
}

.modal-title {
    margin-bottom: 0 !important;
    line-height: 1.5 !important;
    font-size: 1.25rem !important;
    font-weight: 500 !important;
}

.modal-body {
    position: relative !important;
    flex: 1 1 auto !important;
    padding: 1rem !important;
}

.modal-footer {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0.75rem !important;
    border-top: 1px solid #dee2e6 !important;
    border-bottom-right-radius: calc(0.5rem - 1px) !important;
    border-bottom-left-radius: calc(0.5rem - 1px) !important;
    gap: 0.5rem !important;
}

.btn-close {
    box-sizing: content-box !important;
    width: 1em !important;
    height: 1em !important;
    padding: 0.25em 0.25em !important;
    color: #000 !important;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.235.757 8.015 8.015-8.015 8.015c-.21.21-.21.55 0 .76s.55.21.76 0l8.015-8.015 8.015 8.015c.21.21.55.21.76 0s.21-.55 0-.76L8.77 8.757l8.015-8.015c.21-.21.21-.55 0-.76s-.55-.21-.76 0L8.01 7.997-.005-.018c-.21-.21-.55-.21-.76 0s-.21.55 0 .76z'/%3e%3c/svg%3e") center/1em auto no-repeat !important;
    border: 0 !important;
    border-radius: 0.375rem !important;
    opacity: 0.5 !important;
}

.btn-close:hover {
    opacity: 0.75 !important;
}

body.modal-open {
    overflow: hidden !important;
}

[data-theme="dark"] .modal-content {
    background-color: var(--bs-dark) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}

[data-theme="dark"] .result-display {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(25, 135, 84, 0.4);
    color: var(--bs-success);
}

[data-theme="dark"] .history-item {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--bs-primary);
    backdrop-filter: blur(10px);
    color: var(--custom-text-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .names-list {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .names-list .name-item {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--custom-text-dark);
}

[data-theme="dark"] .wheel {
    border-color: rgba(13, 110, 253, 0.6);
    box-shadow: 
        0 0 0 2px rgba(255, 255, 255, 0.2),
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 15px 35px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .wheel-center {
    background: var(--bs-primary);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
    box-shadow: 
        0 0 0 2px rgba(13, 110, 253, 0.5),
        0 4px 12px rgba(0,0,0,0.4);
}

[data-theme="dark"] .wheel-names path {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
}

[data-theme="dark"] .wheel-names text {
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Ensure Bootstrap classes work properly in both themes */
[data-theme="dark"] .bg-primary {
    background-color: var(--bs-primary) !important;
}

[data-theme="dark"] .bg-success {
    background-color: var(--bs-success) !important;
}

[data-theme="dark"] .bg-info {
    background-color: var(--bs-info) !important;
}

[data-theme="dark"] .bg-warning {
    background-color: var(--bs-warning) !important;
}

[data-theme="dark"] .bg-danger {
    background-color: var(--bs-danger) !important;
}

[data-theme="dark"] .text-white {
    color: #ffffff !important;
}

[data-theme="dark"] .text-dark {
    color: var(--custom-text-dark) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--bs-secondary) !important;
}

[data-theme="dark"] .text-secondary {
    color: var(--bs-secondary) !important;
}

/* Ensure proper contrast for form elements */
[data-theme="dark"] .form-control::placeholder {
    color: var(--bs-secondary);
}

[data-theme="dark"] .form-label {
    color: var(--custom-text-dark);
    font-weight: 500;
}

/* Ensure proper contrast for buttons */
[data-theme="dark"] .btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

[data-theme="dark"] .btn-outline-secondary {
    color: var(--bs-secondary);
    border-color: var(--bs-secondary);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: white;
}