 /* ===== ADMIN PANEL ===== */
:root {
    --primary-green: #377850;
    --primary-green-light: #78AF69;
    --primary-orange: #F17210;
    --dark: #212529;
    --gray-100: #F8F9FA;
    --gray-200: #E9ECEF;
    --gray-300: #DEE2E6;
    --gray-400: #CED4DA;
    --gray-500: #ADB5BD;
    --gray-600: #6C757D;
    --gray-700: #495057;
    --gray-800: #343A40;
    --white: #FFFFFF;
    --danger: #DC3545;
    --warning: #FFC107;
    --success: #28A745;
    --info: #17A2B8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: var(--dark);
    background: var(--gray-100);
    line-height: 1.5;
}

/* ===== LOGIN ===== */
.login-body {
    background: linear-gradient(135deg, #1a2e1f 0%, #212529 50%, #1a2332 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Декоративные фоновые элементы */
.login-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    animation: float 8s ease-in-out infinite;
}
.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-green-light);
    top: -120px;
    left: -100px;
    animation-delay: 0s;
}
.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--primary-orange);
    bottom: -80px;
    right: -80px;
    animation-delay: -3s;
}
.shape-3 {
    width: 200px;
    height: 200px;
    background: #4dabf7;
    top: 50%;
    left: 60%;
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-15px, 10px) scale(0.97); }
}

.login-wrap {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.06);
    animation: cardAppear 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

@keyframes cardAppear {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
    animation: fadeInUp 0.5s 0.15s both;
}

.login-logo img {
    max-height: 52px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--dark);
    animation: fadeInUp 0.5s 0.25s both;
}

.login-card > p {
    font-size: 14px;
    color: var(--gray-600);
    text-align: center;
    margin-bottom: 28px;
    animation: fadeInUp 0.5s 0.3s both;
}

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

/* Форма */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fadeInUp 0.5s 0.35s both;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    padding-left: 2px;
}

/* Поле ввода — единый composite-контрол */
.input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

.input-wrap:hover {
    border-color: var(--gray-300);
}

.input-wrap:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
    border-color: var(--primary-green-light);
}

/* Левая секция с иконкой */
.input-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    flex-shrink: 0;
    background: var(--gray-100);
    border-right: 1.5px solid var(--gray-200);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.input-wrap:focus-within .input-icon-wrap {
    background: linear-gradient(135deg, var(--primary-green), #2a6b3f);
    border-right-color: var(--primary-green);
}

.input-icon {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.input-wrap:focus-within .input-icon {
    color: var(--white);
    transform: scale(1.2);
}

/* Сам импут */
.login-form input {
    flex: 1;
    padding: 13px 14px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: transparent;
    color: var(--dark);
    min-width: 0;
    transition: background 0.25s ease;
}

/* Правый отступ под кнопку-глаз для пароля */
.login-form input[type="password"],
.login-form input[type="text"]#password {
    padding-right: 44px;
}

.login-form input::placeholder {
    color: var(--gray-400);
    transition: color 0.25s ease;
}

.login-form input:focus::placeholder {
    color: var(--gray-300);
}

/* Кнопка тоггл пароля */
.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, transform 0.2s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: var(--gray-600);
    background: var(--gray-100);
    transform: translateY(-50%) scale(1.1);
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.95);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* Кнопка входа */
.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-green) 0%, #2a6b3f 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-login:hover::before {
    opacity: 1;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(55,120,80,0.35);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(55,120,80,0.25);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Спиннер */
.btn-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-spinner svg {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ошибка */
.login-error {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-error:empty {
    min-height: 0;
}

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

/* Shake при ошибке */
.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Футер */
.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
    font-size: 12px;
    color: var(--gray-500);
    animation: fadeInUp 0.5s 0.45s both;
}

/* Responsive login */
@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
        border-radius: var(--radius);
    }
    .login-logo img {
        max-height: 44px;
    }
    .login-card h1 {
        font-size: 20px;
    }
    .shape-1, .shape-2, .shape-3 {
        display: none;
    }
}

/* ===== LAYOUT ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo img {
    height: 36px;
}

.sidebar-logo span {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    padding: 8px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.nav-link.active svg {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary-orange);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

.logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--white);
}

/* Main */
.main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-btn {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--gray-100);
    color: var(--dark);
}

.topbar-btn svg {
    width: 20px;
    height: 20px;
}

.content {
    flex: 1;
    padding: 32px;
}

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.card-body {
    padding: 24px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.green { background: rgba(120,175,105,0.1); color: var(--primary-green); }
.stat-icon.orange { background: rgba(241,114,16,0.1); color: var(--primary-orange); }
.stat-icon.blue { background: rgba(23,162,184,0.1); color: var(--info); }
.stat-icon.purple { background: rgba(111,66,193,0.1); color: #6F42C1; }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 2px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray-600);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: var(--gray-100);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-new { background: rgba(23,162,184,0.1); color: var(--info); }
.badge-new::before { background: var(--info); }

.badge-progress { background: rgba(255,193,7,0.1); color: #B38705; }
.badge-progress::before { background: var(--warning); }

.badge-completed { background: rgba(40,167,69,0.1); color: var(--success); }
.badge-completed::before { background: var(--success); }

.badge-closed { background: rgba(108,117,125,0.1); color: var(--gray-600); }
.badge-closed::before { background: var(--gray-500); }

.badge-superadmin { background: rgba(220,53,69,0.1); color: var(--danger); }
.badge-manager { background: rgba(120,175,105,0.1); color: var(--primary-green); }
.badge-support { background: rgba(241,114,16,0.1); color: var(--primary-orange); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #2a6b3f;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

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

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

.btn svg {
    width: 16px;
    height: 16px;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-green-light);
    box-shadow: 0 0 0 3px rgba(120,175,105,0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

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

.form-message {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.form-message-error {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
    border: 1px solid rgba(220,53,69,0.22);
}

.form-message-success {
    background: rgba(40,167,69,0.1);
    color: var(--success);
    border: 1px solid rgba(40,167,69,0.22);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.tab {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--dark);
}

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

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .content {
        padding: 20px;
    }
    .topbar {
        padding: 0 20px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
}

/* Toast animations */
.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 500;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--dark);
    color: var(--white);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 600;
    animation: slideIn 0.25s ease;
}

.toast-error {
    background: var(--danger);
}

.toast-success {
    background: var(--success);
}

.toast-info {
    background: var(--dark);
}

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
