/* frontend/dist/styles.css */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #6366f1;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    cursor: pointer;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

/* Buttons */
button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

button:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
}

button.primary {
    background: var(--accent);
    color: white;
}

button.primary:hover {
    background: #5558e3;
}

button.secondary {
    background: var(--bg-tertiary);
}

button.secondary:hover {
    background: #3a3a3a;
}

button.success {
    background: var(--success);
    color: white;
}

button.danger {
    background: var(--danger);
    color: white;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Grid для карточек стримов - ИСПРАВЛЕНО */
.streams-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 1.5rem !important;
    padding: 1rem 0;
    width: 100%;
}

/* Карточка стрима */
.stream-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    border: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 250px;
}

.stream-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
    border-color: var(--accent);
}

.stream-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stream-title {
    font-size: 1.25rem;
    font-weight: bold;
}

.stream-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.stream-status.live {
    background: var(--danger);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.stream-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stream-card > div:last-child {
    margin-top: auto !important;
}

/* Auth forms */
.auth-form {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Manager layout */
.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.manager-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.streams-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

.stream-editor {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
}

.editor-section {
    margin-bottom: 2rem;
}

.editor-section h3 {
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Utility classes */
.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Inputs and textareas */
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header-content {
        padding: 0 1rem;
    }

    .nav-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-buttons button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .manager-layout {
        grid-template-columns: 1fr;
    }

    .streams-grid {
        grid-template-columns: 1fr !important;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .streams-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Track list items */
.track-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.track-item:hover {
    background: var(--bg-tertiary);
}

.track-item:active {
    cursor: grabbing;
}

.track-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.track-item.drag-over-top {
    border-top: 2px solid var(--accent);
}

.track-item.drag-over-bottom {
    border-bottom: 2px solid var(--accent);
}

.drag-handle {
    cursor: grab;
    padding: 0.25rem;
    margin-right: 0.5rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1;
}

.drag-handle:hover {
    color: var(--accent);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--bg-tertiary);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--accent);
}

/* Comments */
.comment-box {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.comment-author {
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.comment-text {
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.comment-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.comment-file {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: inline-block;
}

.comment-file a {
    color: var(--accent);
    text-decoration: none;
}

.comment-file a:hover {
    text-decoration: underline;
}

/* Access badges */
.access-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.access-badge.public {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.access-badge.own {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent);
}

.access-badge.private {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.access-badge.friends {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Notification badge */
.badge {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

button.danger {
    background: var(--danger);
    color: white;
}

button.danger:hover {
    background: #dc2626;
}
