/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-color: #ffffff;
    --glass-bg: rgba(255,255,255,0.1);
    --glass-border: rgba(255,255,255,0.3);
    --accent-color: #ffd93d;
    --success-color: #4ade80;
    --error-color: #ef4444;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--primary-gradient);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    padding: 30px 20px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

header h1 {
    font-size: 3em;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.holiday-icon {
    display: inline-block;
    font-size: 1.2em;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#current-year {
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: bold;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    margin-top: 10px;
}

/* Top Controls */
.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Language Selector */
.language-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.language-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background: rgba(30, 30, 50, 0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 15px;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 400px;
    overflow-y: auto;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.language-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.language-item.active {
    background: rgba(139, 92, 246, 0.3);
    border-left: 3px solid #8b5cf6;
}

/* Search Container */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    flex: 1;
    min-width: 250px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    color: white;
    font-size: 16px;
    transition: all 0.3s;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.search-clear {
    position: absolute;
    right: 60px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}

.search-clear:hover {
    color: white;
    transform: rotate(90deg);
}

.search-btn {
    position: absolute;
    right: 10px;
    background: rgba(255,255,255,0.2);
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.search-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    background: rgba(30, 30, 50, 0.98);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 15px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 400px;
    overflow-y: auto;
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.suggestion-icon {
    font-size: 1.2em;
}

.suggestion-text {
    flex: 1;
}

.suggestion-tag {
    background: rgba(139, 92, 246, 0.3);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.85em;
    color: #a78bfa;
}

/* Advanced Search Panel */
.advanced-search-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    background: rgba(30, 30, 50, 0.98);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 25px;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.advanced-search-panel h3 {
    margin-bottom: 20px;
    font-size: 1.3em;
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: rgba(255,255,255,0.8);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: white;
    font-size: 0.9em;
}

.filter-group input::placeholder,
.filter-group select {
    color: rgba(255,255,255,0.7);
}

.date-range {
    display: flex;
    gap: 10px;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.search-actions button {
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.search-actions button.primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    border: none;
}

.search-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Search Results Summary */
.search-results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px 20px;
    margin: 20px 0;
}

.results-info {
    font-size: 1.1em;
}

#results-count {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1.3em;
}

/* Year Navigation */
.year-navigation {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.year-navigation button,
.year-navigation select {
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
}

.year-navigation button:hover,
.year-navigation select:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.year-navigation select {
    min-width: 120px;
}

/* Holiday Stats */
.holiday-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Main Content */
main {
    flex: 1;
    padding: 30px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Calendar Wrapper */
.calendar-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

/* Calendar Styles */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.weekday {
    text-align: center;
    font-weight: bold;
    padding: 15px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 10px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 100px;
    overflow: hidden;
}

.calendar-day:hover {
    transform: scale(1.05) translateY(-2px);
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.calendar-day.today {
    background: rgba(139, 92, 246, 0.3);
    border-color: #8b5cf6;
}

.calendar-day.other-month {
    opacity: 0.3;
    cursor: default;
}

.calendar-day.other-month:hover {
    transform: none;
}

.day-number {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 5px;
}

.day-holidays {
    font-size: 0.75em;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
    padding: 0 5px;
}

.holiday-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(255, 217, 61, 0.3);
    border-radius: 8px;
    font-size: 0.7em;
    margin-top: 3px;
    color: var(--accent-color);
}

.calendar-day.search-match {
    background: rgba(139, 92, 246, 0.3) !important;
    border: 2px solid #8b5cf6 !important;
    animation: pulseMatch 2s infinite;
}

.calendar-day.search-no-match {
    opacity: 0.3;
    filter: grayscale(0.5);
}

@keyframes pulseMatch {
    0%, 100% {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.8);
    }
}

.search-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.8em;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Holiday Details Panel */
.holiday-details-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: rgba(30, 30, 50, 0.98);
    border-left: 1px solid rgba(255,255,255,0.2);
    z-index: 2000;
    overflow-y: auto;
    padding: 30px 20px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    transform: rotate(90deg);
}

#holiday-details-content h2 {
    margin-bottom: 15px;
    font-size: 1.8em;
}

.holiday-detail-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.holiday-detail-label {
    font-size: 0.9em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 5px;
}

.holiday-detail-value {
    font-size: 1.1em;
}

/* Footer */
footer {
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 20px;
    text-align: center;
    font-size: 0.9em;
    opacity: 0.8;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s;
}

.footer-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInUp 0.3s ease-out;
    min-width: 250px;
}

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

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

.toast.info {
    border-color: #3b82f6;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 50, 0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 30px;
    z-index: 2000;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

.shortcuts-list {
    display: grid;
    gap: 15px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.shortcut-key {
    background: rgba(139, 92, 246, 0.3);
    padding: 5px 10px;
    border-radius: 8px;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent-color);
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .calendar {
    direction: rtl;
}

[dir="rtl"] .top-controls {
    flex-direction: row-reverse;
}

[dir="rtl"] .language-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] .holiday-details-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid rgba(255,255,255,0.2);
}

[dir="rtl"] #toast-container {
    right: auto;
    left: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.8em;
        gap: 8px;
    }

    .top-controls {
        flex-direction: column;
        gap: 15px;
    }

    .search-container {
        max-width: 100%;
    }

    .search-input {
        font-size: 14px;
        padding: 12px 45px 12px 15px;
    }

    .search-suggestions,
    .advanced-search-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        max-height: 70vh;
    }

    .search-filters {
        grid-template-columns: 1fr;
    }

    .year-navigation {
        gap: 5px;
    }

    .year-navigation button,
    .year-navigation select {
        padding: 8px 15px;
        font-size: 0.85em;
    }

    main {
        padding: 20px 10px;
    }

    .calendar-wrapper {
        padding: 15px;
    }

    .calendar {
        gap: 5px;
    }

    .calendar-day {
        min-height: 80px;
    }

    .day-number {
        font-size: 1.1em;
    }

    .day-holidays {
        font-size: 0.65em;
    }

    .holiday-details-panel {
        width: 100%;
        max-width: 400px;
    }

    .modal {
        width: 95%;
        padding: 20px;
    }

    #toast-container {
        bottom: 10px;
        right: 10px;
    }

    .toast {
        min-width: 200px;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.4em;
    }

    .lang-btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .calendar-day {
        min-height: 70px;
    }

    .day-number {
        font-size: 1em;
    }

    .holiday-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .year-navigation {
        gap: 3px;
    }

    .year-navigation button,
    .year-navigation select {
        padding: 6px 12px;
        font-size: 0.8em;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    header {
        background: transparent;
        border: none;
    }

    .search-container,
    .language-selector,
    footer,
    #toast-container,
    .holiday-details-panel {
        display: none !important;
    }

    .calendar-wrapper {
        background: transparent;
        border: none;
        padding: 0;
    }

    .calendar-day {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
