/* === Кадр дня — Design System === */

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #222222;
    --bg-hover: #2a2a2a;
    --text-primary: #e8e8e8;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --border: #333333;
    --border-light: #2a2a2a;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* === Navigation === */
.nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-light);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-brand:hover {
    color: var(--accent-light);
    text-shadow: 0 0 20px var(--accent-glow);
}

.nav-brand-icon {
    display: flex;
    align-items: center;
}
.nav-brand-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-light);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-link svg {
    width: 18px;
    height: 18px;
}

.nav-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* === Container === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
    flex: 1;
    width: 100%;
}

/* === Flash messages === */
.flash {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

.flash.success {
    background: var(--success-bg);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.flash.danger {
    background: var(--danger-bg);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.flash.warning {
    background: var(--warning-bg);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.flash.info {
    background: var(--info-bg);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

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

/* === Forms === */
.form-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 180px);
}

.form-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.form-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-card .form-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-light);
    color: #000;
    box-shadow: 0 0 24px var(--accent-glow);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.0625rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-link {
    text-align: center;
    margin-top: 18px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-link a {
    font-weight: 600;
}

/* === Footer === */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.footer span {
    color: var(--accent);
}

/* === Headings === */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* === Cards === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow);
}

/* === Utilities === */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* === Grid === */
.grid {
    display: grid;
    gap: 20px;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    margin-bottom: 12px;
    opacity: 0.5;
    display: flex;
    justify-content: center;
}
.empty-state-icon svg {
    width: 48px;
    height: 48px;
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.7;
}

.empty-state a {
    font-weight: 600;
    color: var(--accent);
}

/* === Photo card === */
.photo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.photo-card:hover {
    border-color: var(--accent-dark);
}

.photo-card.mod-pending { border-color: #3b82f6; }
.photo-card.mod-rejected { border-color: #ef4444; }
.photo-card.mod-hidden { border-color: #94a3b8; }

.photo-card-desc-overlay.desc-pending { color: #60a5fa; }
.photo-card-desc-overlay.desc-rejected { color: #fca5a5; }
.photo-card-desc-overlay.desc-hidden { color: #94a3b8; }

.photo-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    background: var(--bg-hover);
}

.photo-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.photo-card:hover .photo-card-image img {
    transform: scale(1.05);
}

/* === Description overlay on image === */
.photo-card-desc-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 12px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 0.8125rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

/* === Rotating state === */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.rotating-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.rotating-spinner {
    animation: spin 0.8s linear infinite;
}

.photo-card.rotating:hover {
    border-color: var(--border);
}
.photo-card.rotating:hover .photo-card-image img {
    transform: none;
}


.photo-card-info {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.photo-card-mood {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.photo-card-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.photo-card-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.photo-card-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.photo-card-rotate {
    flex-shrink: 0;
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-family: inherit;
    outline: none;
}
.photo-card-rotate:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.1);
}
.photo-card-rotate:hover svg {
    transform: rotate(90deg);
}
.photo-card-rotate:active {
    transform: scale(0.92);
}

.photo-card-hide {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-family: inherit;
    outline: none;
}
.photo-card-hide:hover {
    color: #94a3b8;
    border-color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
}

.photo-card-rotate:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.photo-card-rotate:disabled:hover {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}
.photo-card-rotate:disabled:hover svg {
    transform: none;
}

/* === Edit icon === */
.photo-card-edit {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-family: inherit;
    outline: none;
}
.photo-card-edit:hover {
    color: #3b82f6;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}
.photo-card-edit.active {
    color: #3b82f6;
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

/* === Inline description editor === */
.photo-card-desc-edit {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
}
.photo-card-desc-edit textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    border: none;
    border-top: 1px solid #3b82f6;
    font-size: 0.8125rem;
    line-height: 1.4;
    resize: none;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.desc-edit-actions {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.85);
    justify-content: flex-end;
}
.desc-edit-actions button {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.desc-edit-save {
    background: #3b82f6;
    color: #fff;
}
.desc-edit-save:hover {
    background: #2563eb;
}
.desc-edit-cancel {
    background: transparent;
    color: var(--text-muted);
}
.desc-edit-cancel:hover {
    color: var(--text-primary);
}

.photo-rotate-btn svg {
    transition: transform 0.3s ease;
}
.photo-rotate-btn:hover svg {
    transform: rotate(90deg);
}

/* === Date navigator === */
.date-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.date-nav a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.date-nav a:hover {
    color: var(--accent);
    border-color: var(--accent-dark);
    background: var(--bg-hover);
}

.date-nav-date {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* === Responsive === */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }
    .nav {
        padding: 0 12px;
    }
    .nav-links {
        gap: 0;
    }
    .nav-link {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    .nav-link span {
        display: none;
    }
    .form-card {
        padding: 24px 20px;
    }
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    .date-nav {
        flex-wrap: wrap;
        gap: 8px;
    }
    .date-nav-date {
        order: -1;
        width: 100%;
        text-align: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.modal-overlay.active { display: flex; }
.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}
.modal-content img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

.mood-icon-svg {
    display: block;
    flex-shrink: 0;
}
