/* Global box-sizing + form sizing stability */
*, *:before, *:after {
    box-sizing: border-box;
}

input, select, textarea, button {
    min-width: 0;
    max-width: 100%;
}

.form-grid > .form-group,
.track-grid > .form-group,
.track-row,
.form-container {
    min-width: 0;
}

/* Adjust body padding for fixed nav */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    color: #e0e0e0;
    margin: 0;
    padding: 86px 0 0 0; /* clears the fixed 72px nav */
    line-height: 1.45;
    font-size: 14px;
    min-height: 100vh;
}

.app-header {
    background: #000;
    border-bottom: 1px solid #333;
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.app-title {
    font-size: 1.5em;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.95em;
    color: #888;
    margin: 2px 0 0 0;
    font-weight: 300;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
}

.form-container {
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    border: 1px solid #333;
}

.form-section {
    padding: 16px 18px;
    border-bottom: 1px solid #333;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    color: #fff;
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.form-group {
    margin-bottom: 0;
}

.form-container form .form-group {
    margin-bottom: 12px;
}

.form-container form .form-group:last-child {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #b0b0b0;
    font-size: 0.85em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-size: 14px;
    transition: all 0.3s ease;
}

input::placeholder {
    color: #666;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
select:focus {
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0, 122, 204, 0.1);
    outline: none;
    background-color: #333;
}

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    font-weight: 400;
    cursor: pointer;
}

.checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.track-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #252525;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.track-row:hover {
    border-color: #555;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.drag-handle {
    cursor: grab;
    margin-right: 10px;
    font-size: 16px;
    color: #666;
    padding-top: 5px;
    transition: color 0.3s;
}

.drag-handle:hover {
    color: #007acc;
}

.track-content {
    flex: 1;
}

.track-grid {
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
}

.track-grid .form-group,
.form-container form .track-grid .form-group {
    margin: 0;
}

.track-grid .checkboxes {
    flex-direction: column;
    align-items: flex-start;
}

.spoken-fields {
    display: flex;
    gap: 10px;
    align-items: end;
}

.spoken-fields select {
    flex: 1;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-size: 14px;
    min-width: 80px;
}

.spoken-fields {
    display: flex;
    gap: 10px;
    align-items: end;
}

.spoken-fields input {
    flex: 1;
}

.remove-track {
    background-color: #d32f2f;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 15px;
    flex-shrink: 0;
}

.remove-track:hover {
    background-color: #b71c1c;
    transform: scale(1.1);
}

.btn-primary {
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 12px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.form-actions {
    padding: 16px 18px;
    background: #252525;
    text-align: center;
    border-top: 1px solid #333;
}

.btn-submit {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 160px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

#durationWarning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #000;
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 10px;
    font-weight: 500;
    border-left: 4px solid #e65100;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 16px 14px;
    text-align: center;
    transition: all 0.3s ease;
    background: #2a2a2a;
    position: relative;
}

.upload-zone.drag-over {
    border-color: #007acc;
    background: #1a2a3a;
}

.upload-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.upload-icon {
    font-size: 1.8em;
}

.upload-text {
    color: #888;
    font-size: 1em;
}

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Progress state */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-filename {
    color: #e0e0e0;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
    text-align: left;
}

.upload-size {
    color: #888;
    font-size: 0.9em;
    flex-shrink: 0;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #444;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #007acc, #00a8ff);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.upload-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-percent {
    color: #007acc;
    font-weight: 600;
    font-size: 0.95em;
}

.upload-cancel {
    background: #d32f2f;
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.upload-cancel:hover {
    background: #b71c1c;
}

/* Done state */
.upload-done {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.upload-done-icon {
    background: #28a745;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.upload-done-text {
    color: #e0e0e0;
    font-weight: 500;
}

.upload-change {
    background: #444;
    color: #e0e0e0;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.upload-change:hover {
    background: #555;
}

/* Submit button disabled state */
.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Submission result page */
.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
}

.result-success {
    background: #28a745;
    color: white;
}

.result-error {
    background: #d32f2f;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 20px 10px;
    }
    .form-section {
        padding: 20px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .track-grid {
        grid-template-columns: 1fr;
    }
    .track-row {
        flex-direction: column;
    }
    .drag-handle {
        align-self: flex-start;
        margin-bottom: 10px;
    }
    .remove-track {
        align-self: flex-end;
        margin-left: 0;
        margin-top: 10px;
    }
    .app-title {
        font-size: 1.3em;
    }
}

/* Admin Table Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9em;
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.admin-table th,
.admin-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.admin-table th {
    background: #252525;
    color: #999;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    color: #e0e0e0;
}

.admin-table tbody tr:hover {
    background: #252525;
}

.btn-small {
    background: #444;
    color: #e0e0e0;
    border: none;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 5px;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: #555;
    transform: translateY(-1px);
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

/* Email button */
.btn-email {
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
    color: white;
}

.btn-email:hover {
    background: linear-gradient(135deg, #0090e8 0%, #006abb 100%);
}

/* Playlist actions cell */
.playlist-actions {
    white-space: nowrap;
}

.playlist-actions .btn-small {
    margin-bottom: 4px;
}

/* Playlist view meta grid */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.85em;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    color: #e0e0e0;
    font-size: 1em;
}

.meta-actions .btn-small {
    margin-right: 8px;
}

