* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 50px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-container h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.demo-note {
    margin-top: 20px;
    color: #7f8c8d;
    font-size: 0.9em;
    font-style: italic;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 20px;
    position: relative;
}

h1 {
    color: #2c3e50;
    font-size: 2.5em;
}

.user-info {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #7f8c8d;
    font-size: 0.9em;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.current-time {
    margin-left: auto;
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
}

.btn-info {
    background-color: #9b59b6;
    color: white;
}

.btn-info:hover {
    background-color: #8e44ad;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Clocks Section */
.clocks-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.clock-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clock-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.clock-label {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.clock-display {
    font-size: 4em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.clock-hint {
    font-size: 0.9em;
    opacity: 0.8;
    font-style: italic;
}

/* Query Section */
.query-section {
    margin-bottom: 30px;
}

.query-input-section {
    margin-bottom: 15px;
}

.query-input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.query-input-section input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.query-input-section input:focus {
    outline: none;
    border-color: #667eea;
}

.query-input-section select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
}

.query-input-section select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.filter-group input,
.filter-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.year-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-inputs input {
    flex: 1;
    width: auto;
}

.year-inputs span {
    color: #7f8c8d;
    font-weight: 500;
}

@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.query-results {
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    max-height: 300px;
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #667eea;
    color: white;
}

.results-title {
    font-weight: bold;
    font-size: 1.1em;
}

.close-results {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.results-list {
    max-height: 250px;
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    transition: background 0.2s;
}

.result-item:hover {
    background: #e9ecef;
}

.result-song {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.result-artist {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 3px;
}

.result-duration {
    color: #3498db;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

/* Schedule Display */
.schedule-container {
    display: flex;
    margin: 30px 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.time-labels {
    width: 80px;
    background: #f8f9fa;
    border-right: 2px solid #ddd;
}

.time-label {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #ddd;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
}

.schedule-track {
    flex: 1;
    position: relative;
    background: white;
    min-height: 600px;
}

.schedule-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 50px;
    border-bottom: 1px solid #e0e0e0;
}

.grid-line:nth-child(even) {
    background: #fafafa;
}

.events-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.event {
    position: absolute;
    left: 10px;
    right: 10px;
    border-radius: 8px;
    padding: 8px 12px;
    color: #2c3e50;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.event:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.event.static {
    background-color: #fff9e6;
    border: 3px solid #f1c40f;
    border-left: 8px solid #f39c12;
}

.event.dynamic {
    background-color: #e8f8f5;
    border: 3px solid #2ecc71;
    border-left: 8px solid #27ae60;
    cursor: move;
}

.event.dynamic:hover {
    opacity: 0.9;
}

.event-name {
    font-size: 1em;
    margin-bottom: 3px;
    color: #2c3e50;
}

.event-time {
    font-size: 0.85em;
    opacity: 0.8;
    color: #555;
}

.event.dragging {
    opacity: 0.6;
    z-index: 1000;
}

.current-time-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #e74c3c;
    z-index: 100;
    pointer-events: none;
}

.current-time-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50%;
}

.legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 50px;
    height: 30px;
    border-radius: 5px;
}

.legend-color.static {
    background-color: #fff9e6;
    border: 3px solid #f1c40f;
    border-left: 8px solid #f39c12;
}

.legend-color.dynamic {
    background-color: #e8f8f5;
    border: 3px solid #2ecc71;
    border-left: 8px solid #27ae60;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.confirm-content {
    max-width: 400px;
    text-align: center;
}

.confirm-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.confirm-content p {
    color: #555;
    margin-bottom: 30px;
    font-size: 1.1em;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close, .close-template {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover, .close-template:hover {
    color: #000;
}

#modalTitle, #templateModalTitle {
    color: #2c3e50;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.form-actions .btn {
    flex: 1;
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    min-width: 180px;
}

.context-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    color: #2c3e50;
}

.context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Template List */
.template-list {
    max-height: 400px;
    overflow-y: auto;
}

.template-item {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.template-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.template-info {
    font-size: 0.9em;
    color: #7f8c8d;
}

.no-templates {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.save-template-form {
    margin-top: 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .clocks-section {
        grid-template-columns: 1fr;
    }

    .clock-display {
        font-size: 3em;
    }

    .controls {
        flex-direction: column;
    }

    .current-time {
        margin-left: 0;
        margin-top: 10px;
    }
}
