/* === BASE STYLES WITH THEME SUPPORT === */

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

/* CSS Variables for theming */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-color: #4a9eff;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-color: rgba(255, 255, 255, 0.1);
    --grid-cell-bg: #1a1a1a;
    --grid-past-color: #ffffff;
    --grid-future-color: #1a1a1a;
    --transition-speed: 0.3s;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

/* === TOP CONTROLS === */
.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 1000;
}

.format-toggle {
    padding: 8px 16px;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.format-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* === THEME CHOOSER === */
.theme-chooser {
    position: relative;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(180deg);
}

.theme-toggle svg {
    fill: currentColor;
}

.theme-grid {
    position: absolute;
    top: 50px;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.theme-grid.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    width: 70px;
    height: 70px;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    border-color: var(--accent-color);
}

.theme-option.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.5);
}

.theme-icon {
    font-size: 24px;
}

.theme-name {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === THEME EFFECTS CONTAINER === */
.theme-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* === MAIN CONTAINER === */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px;
    width: 100%;
    z-index: 10;
    position: relative;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    width: 100%;
}

.control-btn {
    width: 48px;
    height: 48px;
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}

/* === CLOCK VIEW === */
.clock-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.clock-view.hidden {
    display: none;
}

.time-display {
    font-size: 120px;
    font-weight: 200;
    letter-spacing: -2px;
    margin: 40px 0;
    font-variant-numeric: tabular-nums;
    transition: all 0.5s ease;
    display: inline-block;
    position: relative;
    left: 30px;
    color: var(--text-primary);
}

.time-display #hours,
.time-display #minutes {
    display: inline-block;
}

.time-display .colon {
    display: inline-block;
    text-align: center;
    margin: 0 2px;
}

.time-display.calendar-mode {
    font-size: 48px;
    margin: 20px 0;
    left: 12px;
}

.time-display .seconds {
    font-size: 60px;
    opacity: 0.5;
    margin-left: 5px;
}

.time-display.calendar-mode .seconds {
    font-size: 24px;
    margin-left: 2px;
}

.week-grid-wrapper {
    display: inline-block;
    position: relative;
}

.hour-labels {
    display: block;
    margin-bottom: 16px;
    padding-left: 60px;
    padding-right: 30px;
    font-size: 10px;
    opacity: 0.3;
    position: relative;
    width: calc(60px + 48 * 14px + 47 * 2px);
    color: var(--text-secondary);
}

.hour-labels span {
    position: absolute;
}

.hour-labels span:nth-child(1) { left: 60px; }
.hour-labels span:nth-child(2) { left: calc(60px + 191.5px); }
.hour-labels span:nth-child(3) { left: calc(60px + 383px - 20px); }
.hour-labels span:nth-child(4) { left: calc(60px + 574.5px); }
.hour-labels span:nth-child(5) { right: 0; }

#weekGrid {
    display: inline-block;
}

.date-display {
    font-size: 18px;
    opacity: 0.6;
    margin-bottom: 40px;
    margin-left: 50px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.day-grid {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.day-label {
    width: 45px;
    font-size: 12px;
    opacity: 0.5;
    text-align: right;
    margin-right: 15px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.day-label.current-day {
    opacity: 1;
    color: var(--accent-color);
}

.grid-row {
    display: flex;
    gap: 2px;
}

.grid-cell {
    width: 14px;
    height: 14px;
    background: var(--grid-cell-bg);
    border-radius: 2px;
    transition: all var(--transition-speed) ease;
    position: relative;
}

/* === GRID ANIMATIONS === */
@keyframes pulse-past {
    0%, 100% { 
        background: var(--grid-past-color);
        opacity: 0.3;
    }
    50% { 
        background: var(--grid-past-color);
        opacity: 0.8;
    }
}

@keyframes pulse-future {
    0%, 100% { 
        background: var(--grid-future-color);
        opacity: 0.5;
    }
    50% { 
        background: var(--grid-future-color);
        opacity: 0.8;
    }
}

@keyframes pulse-current {
    0%, 100% { 
        background: var(--accent-color);
        box-shadow: 0 0 10px var(--accent-color);
        transform: scale(1);
    }
    50% { 
        background: var(--accent-color);
        box-shadow: 0 0 20px var(--accent-color);
        transform: scale(1.1);
    }
}

.grid-cell.past-1 {
    animation: pulse-past 3s infinite;
    animation-delay: 0s;
}

.grid-cell.past-2 {
    animation: pulse-past 3.5s infinite;
    animation-delay: 0.5s;
}

.grid-cell.past-3 {
    animation: pulse-past 4s infinite;
    animation-delay: 1s;
}

.grid-cell.past-4 {
    animation: pulse-past 2.5s infinite;
    animation-delay: 0.2s;
}

.grid-cell.future-1 {
    animation: pulse-future 4s infinite;
    animation-delay: 0.3s;
}

.grid-cell.future-2 {
    animation: pulse-future 3s infinite;
    animation-delay: 0.7s;
}

.grid-cell.future-3 {
    animation: pulse-future 3.5s infinite;
    animation-delay: 1.2s;
}

.grid-cell.current-half-hour {
    animation: pulse-current 2s infinite;
}

/* === WORD DISPLAY === */
@keyframes word-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.4;
    }
    50% { 
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes word-flash {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes word-wave {
    0% { 
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    25% {
        transform: translateY(-2px) scale(1.1);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(0) scale(1.2);
        opacity: 1;
    }
    75% {
        transform: translateY(2px) scale(1.1);
        opacity: 0.7;
    }
    100% { 
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
}

.grid-cell.word-letter {
    position: relative;
    z-index: 10;
}

.grid-cell.word-letter::after {
    content: attr(data-letter);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 0 5px currentColor;
    pointer-events: none;
}

.grid-cell.word-letter.word-pulse {
    animation: word-pulse 2s infinite;
}

.grid-cell.word-letter.word-flash {
    animation: word-flash 1.5s infinite;
}

.grid-cell.word-letter.word-wave {
    animation: word-wave 3s infinite;
}

/* === MATRIX DISPLAY === */
@keyframes matrix-pulse {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(0.9);
        filter: brightness(0.8);
    }
    50% { 
        opacity: 1;
        transform: scale(1.1);
        filter: brightness(1.2);
    }
}

@keyframes matrix-wave {
    0% { 
        opacity: 0.3;
        transform: scale(0.8) translateY(2px);
        filter: brightness(0.7);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2) translateY(-2px);
        filter: brightness(1.3);
    }
    100% { 
        opacity: 0.3;
        transform: scale(0.8) translateY(2px);
        filter: brightness(0.7);
    }
}

.grid-cell.matrix-active {
    transition: all var(--transition-speed) ease;
    z-index: 50 !important;
}

.grid-cell.matrix-pulse {
    animation: matrix-pulse 1.5s infinite;
}

.grid-cell.matrix-wave {
    animation: matrix-wave 2s infinite;
}

/* === CALENDAR VIEW === */
.calendar-view {
    display: none;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.calendar-view.visible {
    display: block;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.month-nav {
    width: 32px;
    height: 32px;
    background: var(--hover-color);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.month-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.month-title {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.weekday-header {
    font-size: 11px;
    opacity: 0.4;
    padding: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.calendar-day {
    aspect-ratio: 1;
    background: var(--grid-cell-bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-speed);
    cursor: pointer;
    position: relative;
    color: var(--text-primary);
}

.calendar-day:hover {
    background: var(--hover-color);
}

.calendar-day.other-month {
    opacity: 0.2;
}

.calendar-day.today {
    background: var(--accent-color);
    font-weight: bold;
    box-shadow: 0 0 15px var(--accent-color);
}

.calendar-day.past {
    background: rgba(255, 255, 255, 0.05);
}

.stats {
    margin-top: 40px;
    font-size: 14px;
    opacity: 0.4;
    letter-spacing: 1px;
    text-align: center;
    color: var(--text-secondary);
}

/*
/* === SYNC MODULE STYLES === */

/* Sync Status Indicator */
.sync-status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sync-status-indicator:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

.sync-status-indicator.online {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.sync-status-indicator.offline {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
}

.sync-status-indicator.syncing .sync-icon {
    animation: rotate 1s linear infinite;
}

.sync-status-indicator.success {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.4);
}

.sync-status-indicator.error {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.3);
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sync-icon {
    font-size: 16px;
}

.sync-text {
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sync Modal */
.sync-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sync-modal-content {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sync-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sync-modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
}

.sync-modal-body {
    padding: 20px;
}

#sync-login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#sync-login-form input {
    padding: 12px;
    background: var(--bg-primary, #0a0a0a);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

#sync-login-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(74, 158, 255, 0.3);
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-actions button {
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-actions button[value="login"] {
    background: var(--accent-color, #4a9eff);
    color: white;
}

.form-actions button[value="register"] {
    background: var(--hover-color);
    color: var(--text-primary);
}

.form-actions button:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

/* Sync Menu */
.sync-menu {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 10002;
}

.sync-menu-item {
    padding: 10px 15px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-menu-item:hover {
    background: var(--hover-color);
}

.sync-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

/* Sync Animation für Termine */
@keyframes syncPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.appointment.syncing {
    animation: syncPulse 1s;
}

/* Responsive */
@media (max-width: 768px) {
    .sync-status-indicator {
        bottom: 80px;
        right: 10px;
    }
    
    .sync-modal-content {
        width: 95%;
    }
    
    .form-actions {
        grid-template-columns: 1fr;
    }
}
