:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.01);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Entrance animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes rowIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-icon {
    font-size: 1.4rem;
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover .logo-icon {
    transform: rotate(-12deg) scale(1.15);
}

.logo-text {
    background: linear-gradient(135deg, #fff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #9ca3af;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    animation: slideInLeft 0.4s ease backwards;
}

.nav-menu .nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-menu .nav-item:nth-child(2) { animation-delay: 0.12s; }
.nav-menu .nav-item:nth-child(3) { animation-delay: 0.19s; }
.nav-menu .nav-item:nth-child(4) { animation-delay: 0.26s; }

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    border-radius: 3px;
    background: #818cf8;
    opacity: 0;
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    padding-left: 18px;
}

.nav-item:hover::before {
    opacity: 1;
    transform: scaleY(1);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(99,102,241,0.1));
    color: #fff;
}

.nav-item.active::before {
    opacity: 1;
    transform: scaleY(1);
}

.nav-item i {
    font-size: 1.15rem;
    transition: transform 0.3s ease;
}

.nav-item:hover i {
    transform: scale(1.15);
}

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

.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    margin-bottom: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-mini .username {
    font-size: 0.85rem;
    color: #d1d5db;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    padding-left: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
}

.date {
    font-size: 0.83rem;
    color: var(--gray-500);
    font-weight: 500;
}

.notif-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    margin-right: 12px;
    border: 1.5px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.notif-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.notif-btn i {
    font-size: 1.05rem;
}

.notif-btn.notif-on i {
    color: var(--success);
    animation: pulse 2s ease infinite;
    /* оживающая на секунду иконка при показе уведомления */
}

/* Stats — compact pills */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 32px 0;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    animation: fadeUp 0.45s ease backwards;
}

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.12s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.19s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.26s; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card.valid { border-bottom: 2px solid var(--success); }
.stat-card.expiring { border-bottom: 2px solid var(--warning); }
.stat-card.expired { border-bottom: 2px solid var(--danger); }
.stat-card.total { border-bottom: 2px solid var(--primary); }

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.valid-icon { background: var(--success-light); color: var(--success); }
.expiring-icon { background: var(--warning-light); color: var(--warning); }
.expired-icon { background: var(--danger-light); color: var(--danger); }
.total-icon { background: var(--primary-light); color: var(--primary); }

.stat-info span:first-child {
    display: block;
    font-size: 0.68rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
}

.stat-info span:last-child {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 10px;
    padding: 20px 32px 16px;
    align-items: center;
}

.search-form {
    flex: 1;
    position: relative;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.1rem;
    transition: color var(--transition);
}

.search-input-wrapper:focus-within .search-icon {
    color: var(--primary);
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    transition: var(--transition);
    outline: none;
    background: #fff;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
    color: var(--gray-400);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn i, .btn span {
    position: relative;
    z-index: 1;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.btn:active::after {
    width: 250px;
    height: 250px;
    transition: 0s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
}

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

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Flash messages */
.flash-wrapper {
    padding: 16px 32px 0;
}

.alert {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeUp 0.35s ease;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-light); color: #1e40af; border-color: #bfdbfe; }

/* Bulk Form — animated expand/collapse */
.bulk-form-container {
    padding: 0 32px 8px;
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin 0.4s ease;
    margin-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.bulk-form-container.open {
    grid-template-rows: 1fr;
    opacity: 1;
    pointer-events: auto;
    margin-bottom: 8px;
}

.bulk-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    min-height: 0;
}

.bulk-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    height: 110px;
    outline: none;
    transition: var(--transition);
}

.bulk-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Table */
.table-container {
    padding: 4px 32px 32px;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.results-table th,
.results-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
}

.results-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 58px;
    z-index: 10;
}

.results-table td {
    border-bottom: 1px solid var(--gray-100);
}

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

.results-table tbody tr {
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    animation: rowIn 0.4s ease backwards;
}

.results-table tbody tr:hover {
    background: #f8f9ff;
}

.results-table .domain-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.results-table .domain-link:hover {
    color: var(--primary-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: var(--transition);
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-valid { background: var(--success-light); color: var(--success); }
.badge-expiring { background: var(--warning-light); color: var(--warning); }
.badge-expired { background: var(--danger-light); color: var(--danger); }
.badge-error { background: var(--danger-light); color: var(--danger); }
.badge-checking { background: var(--gray-100); color: var(--gray-600); }

.badge-error::before,
.badge-expiring::before {
    animation: pulse 1.6s ease-in-out infinite;
}

/* Status colors in text */
.status-success { color: var(--success); font-weight: 600; }
.status-warning { color: var(--warning); font-weight: 600; }
.status-danger { color: var(--danger); font-weight: 600; }

/* Actions Column */
.actions-cell {
    display: flex;
    gap: 8px;
}

.actions-cell .btn-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-sm.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-sm.btn-danger:hover { background: var(--danger); color: #fff; transform: translateY(-1px); }
.btn-sm.btn-danger:active { transform: translateY(0); }

/* Empty state */
.empty-row td {
    text-align: center;
    padding: 40px 16px !important;
    color: var(--gray-400);
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #818cf8 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .logo-icon {
    font-size: 2.6rem;
    display: block;
    margin-bottom: 8px;
    animation: fadeIn 0.6s ease backwards;
}

.auth-logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.auth-form .form-group {
    animation: fadeUp 0.4s ease backwards;
}

.auth-form .form-group:nth-of-type(1) { animation-delay: 0.1s; }
.auth-form .form-group:nth-of-type(2) { animation-delay: 0.18s; }

.auth-form button {
    animation: fadeUp 0.4s ease 0.26s backwards;
}

.auth-form input {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background: #fff;
}

.auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.auth-form .btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.auth-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
    animation: fadeIn 0.5s ease 0.35s backwards;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-footer a:hover {
    text-decoration: underline;
    letter-spacing: 0.01em;
}

/* Page Container */
.page-container {
    padding: 0 32px 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeUp 0.4s ease;
}

/* Edit Page */
.edit-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.edit-info h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.edit-info .status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.edit-details {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--gray-100);
    animation: fadeUp 0.35s ease backwards;
}

.edit-details .detail-row:nth-child(1) { animation-delay: 0.05s; }
.edit-details .detail-row:nth-child(2) { animation-delay: 0.1s; }
.edit-details .detail-row:nth-child(3) { animation-delay: 0.15s; }
.edit-details .detail-row:nth-child(4) { animation-delay: 0.2s; }
.edit-details .detail-row:nth-child(5) { animation-delay: 0.25s; }
.edit-details .detail-row:nth-child(6) { animation-delay: 0.3s; }
.edit-details .detail-row:nth-child(7) { animation-delay: 0.35s; }
.edit-details .detail-row:nth-child(8) { animation-delay: 0.4s; }

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--gray-500);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 500;
}

.text-small {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.edit-actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}

/* Settings Page */
.settings-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
    animation: fadeUp 0.45s ease backwards;
}

.settings-card:nth-child(2) { animation-delay: 0.1s; }

.settings-card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--gray-800);
}

.settings-info p {
    color: var(--gray-600);
    line-height: 1.8;
}

.settings-form .form-group {
    margin-bottom: 16px;
    animation: fadeUp 0.35s ease backwards;
}

.settings-form .form-group:nth-of-type(1) { animation-delay: 0.08s; }
.settings-form .form-group:nth-of-type(2) { animation-delay: 0.15s; }
.settings-form .form-group:nth-of-type(3) { animation-delay: 0.22s; }

.settings-form label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.settings-form input {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.settings-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .stats-grid {
        padding: 16px 16px 0;
    }
    .actions-bar {
        padding: 16px 16px 12px;
        flex-wrap: wrap;
    }
    .flash-wrapper {
        padding: 12px 16px 0;
    }
    .table-container {
        padding: 4px 16px 16px;
    }
    .results-table th,
    .results-table td {
        padding: 10px 10px;
    }
    .results-table th:nth-child(3),
    .results-table th:nth-child(4) {
        display: none;
    }
    .page-container {
        padding: 0 16px 16px;
    }
    .header {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        flex: 1 1 calc(50% - 10px);
        padding: 8px 12px;
    }
    .results-table th:nth-child(4),
    .results-table th:nth-child(5),
    .results-table th:nth-child(6),
    .results-table th:nth-child(7) {
        display: none;
    }
}
