:root {
    --bg-color: #0f111a;
    --text-primary: #ffffff;
    --text-secondary: #a0aabf;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

#app {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Alert Banner */
.alert-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideDown 0.5s ease-out;
}

.alert-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #fca5a5;
}

.close-alert {
    background: none;
    border: none;
    color: #fca5a5;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.close-alert:hover {
    color: white;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a0aabf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Glassmorphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

/* Form Section */
.form-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.input-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="time"],
input[type="number"],
input[type="file"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-speed);
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Custom File Input */
input[type="file"] {
    padding: 0.5rem;
}
input[type="file"]::file-selector-button {
    background: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    margin-right: 1rem;
    font-weight: 500;
    transition: background var(--transition-speed);
}
input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: all var(--transition-speed);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Schedules Section */
.schedules-section {
    margin-top: 2rem;
}

.schedules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.schedules-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sort-controls select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
}

.sort-controls select option {
    background: var(--bg-color);
    color: white;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin-top: 0;
    width: auto;
}

.schedules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.schedule-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: fadeIn 0.5s ease-out forwards;
    will-change: transform;
}

.schedule-card.playing-state {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    animation: pulse-glow 2s infinite;
}

.schedule-card.disabled-state {
    opacity: 0.6;
    filter: grayscale(80%);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.7); border-color: var(--primary-color); }
    100% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.4); }
}

/* Toggle Switch Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--primary-color);
}
input:checked + .slider:before {
  transform: translateX(16px);
}
.slider.round {
  border-radius: 20px;
}
.slider.round:before {
  border-radius: 50%;
}


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

.conflict-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #fcd34d;
}

.conflict-warning strong {
    color: #fbbf24;
}

.btn-resolve {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-speed);
}

.btn-resolve:hover {
    background: rgba(245, 158, 11, 0.4);
    color: white;
}

.schedule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.schedule-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.card-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.btn-play,
.btn-stop,
.btn-edit,
.btn-delete {
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    flex: 1;
}

.btn-play {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-play:hover {
    background: #10b981;
    color: white;
}

.btn-stop {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-stop:hover:not(:disabled) {
    background: #f59e0b;
    color: white;
}

.btn-stop:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.btn-edit {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
}

/* Visualizer */
.visualizer {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.visualizer.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.visualizer-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.visualizer-content span {
    font-size: 0.95rem;
    font-weight: 600;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 24px;
}

.bar {
    width: 6px;
    background-color: var(--primary-color);
    border-radius: 3px;
    animation: bounce 0.5s ease infinite alternate;
    transform-origin: bottom;
}

.bar:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.bar:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.bar:nth-child(3) { height: 24px; animation-delay: 0.3s; }
.bar:nth-child(4) { height: 12px; animation-delay: 0.4s; }
.bar:nth-child(5) { height: 20px; animation-delay: 0.5s; }

@keyframes bounce {
    0% { transform: scaleY(0.3); }
    100% { transform: scaleY(1); }
}

@media (max-width: 600px) {
    .row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.close-modal:hover {
    color: white;
}

.modal-body {
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.upcoming-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.upcoming-table th,
.upcoming-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.upcoming-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
}

.upcoming-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.upcoming-table td {
    font-size: 0.95rem;
}

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