/* ============================================
   VIPROM Admin Panel — moderný dizajn
   ============================================ */

:root {
    --primary: #c8a960;
    --primary-dark: #a88b3d;
    --primary-light: #e8d5a0;
    --bg: #0a0c12;
    --bg-elevated: #12151e;
    --bg-card: #181b26;
    --bg-input: #1f2330;
    --bg-hover: #252a38;
    --border: #262a38;
    --border-light: #343a4d;
    --text: #f5f5f7;
    --text-secondary: #c5c7d1;
    --text-muted: #7c7f8e;
    --success: #4ade80;
    --danger: #f87171;
    --info: #60a5fa;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.3);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    background-image:
        radial-gradient(circle at 20% 0%, rgba(200, 169, 96, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(200, 169, 96, 0.03) 0%, transparent 50%);
}

::selection { background: rgba(200, 169, 96, 0.3); }

/* ---- LOGIN ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.3rem;
    letter-spacing: 2px;
}

.login-box .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.login-box .error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--danger);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* ---- HEADER ---- */
.admin-header {
    background: rgba(18, 21, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-header h1::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ---- MAIN ---- */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ---- PREVIEW BAR ---- */
.preview-bar {
    background: linear-gradient(135deg, rgba(200, 169, 96, 0.08), rgba(200, 169, 96, 0.03));
    border: 1px solid rgba(200, 169, 96, 0.15);
    border-radius: var(--radius);
    padding: 0.9rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.preview-bar span {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-bar span::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
}

/* ---- TABS ---- */
.tabs {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 1.8rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 0.85rem 1.3rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    position: relative;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text);
    background: rgba(255,255,255,0.02);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

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

/* ---- FORMS ---- */
.form-group { margin-bottom: 1.3rem; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: var(--border-light);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px rgba(200, 169, 96, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

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

/* ---- BUTTONS ---- */
.btn {
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    letter-spacing: 0.2px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(200, 169, 96, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(200, 169, 96, 0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 0.5rem 0.9rem;
    font-size: 0.75rem;
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-logout:hover {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.05);
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    margin-bottom: 1.2rem;
    transition: border-color 0.2s;
}

.card:hover { border-color: var(--border-light); }

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1.3rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.card-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

/* ---- VIDEO LIST ---- */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.video-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 1.2rem;
    align-items: center;
    transition: all 0.2s;
}

.video-item:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
}

.video-item-thumb {
    width: 160px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
}

.video-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-item-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.video-item-info p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.video-item-info .video-date {
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
}

.video-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---- ADD VIDEO FORM ---- */
.add-video-form {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.8rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 0 0 3px rgba(200, 169, 96, 0.08);
}

.add-video-form h3 {
    color: var(--primary);
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ---- PRICING / STATS ITEMS ---- */
.pricing-items, .stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pricing-item, .stat-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.stat-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
}

.pricing-item input, .stat-item input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    transition: all 0.2s;
}

.pricing-item input:focus, .stat-item input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(200, 169, 96, 0.1);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.2rem 0.5rem;
    opacity: 0.6;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
}

.btn-remove:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

/* ---- TOAST ---- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.9rem 1.3rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.85rem;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
}

.toast-error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

/* ---- DASHBOARD ---- */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(200, 169, 96, 0.3);
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0.6;
}

.stat-label-top {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.stat-big {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-weight: 500;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    height: 180px;
    padding-top: 1.8rem;
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--primary), rgba(200, 169, 96, 0.2));
    border-radius: 6px 6px 0 0;
    min-height: 3px;
    position: relative;
    transition: all 0.2s;
    margin-top: auto;
    cursor: pointer;
}

.chart-bar:hover {
    background: linear-gradient(180deg, var(--primary-light), rgba(200, 169, 96, 0.3));
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.chart-bar span {
    position: absolute;
    top: -1.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.chart-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    white-space: nowrap;
    font-weight: 500;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.2rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 70px;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.82rem;
}

.bar-row:last-child { margin-bottom: 0; }

.bar-label {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.bar-track {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-value {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: right;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---- TOGGLE SWITCH ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    transition: all 0.3s;
    border-radius: 28px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    transition: all 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(200, 169, 96, 0.2);
    border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--primary);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .admin-main { padding: 1rem; }
    .admin-header { padding: 0.8rem 1rem; }
    .video-item { grid-template-columns: 1fr; }
    .video-item-thumb { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .stat-item { grid-template-columns: 1fr 1fr auto; }
    .tab { padding: 0.6rem 0.9rem; font-size: 0.78rem; }
    .card { padding: 1.3rem; }
    .toast { left: 1rem; right: 1rem; bottom: 1rem; }
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .stat-big { font-size: 1.8rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 90px 1fr 60px; font-size: 0.78rem; }
    .chart-label { font-size: 0.6rem; }
}
