@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

html {
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

:root {
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --border-color: #334155;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --accent: #a855f7;
    --success: #10b981;
    --success-hover: #059669;
    --error: #ef4444;
    --error-hover: #dc2626;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Typography headers */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    font-weight: 600;
}

/* Gradient background decoration */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.05) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* Container limits */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header & Nav */
header {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background-color: var(--bg-surface-hover);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.badge-viewer {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}

/* Button style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
}

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

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

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

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

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

/* Main content structure */
main {
    flex: 1;
    padding-bottom: 50px;
}

/* Login screen */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
    padding: 20px;
}

.login-card {
    background: rgba(30, 41, 59, 0.45);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

/* Flash alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-out;
}

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

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

/* Dashboard summary blocks */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.dashboard-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.dashboard-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.dashboard-card .value {
    font-size: 32px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--text-main);
}

.dashboard-card::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

/* Card list structures (Groups screen) */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.group-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.group-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 20px -10px rgba(99, 102, 241, 0.3);
}

.group-img-wrapper {
    height: 160px;
    width: 100%;
    position: relative;
    background-color: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.group-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.group-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.group-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

.group-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Page Header component */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header-title h2 {
    font-size: 28px;
    font-weight: 700;
}

.page-header-title p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Modern tables list layout */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-height: 250px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px 20px;
    background-color: rgba(15, 23, 42, 0.3);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 9px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Inline action styles */
.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Table specific items */
.td-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.table-system-title {
    font-weight: 600;
    font-size: 15px;
}

/* Status toggles/badges */
.badge-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-inactive {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-origin {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.badge-upload {
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.badge-url {
    background-color: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

/* URL Copier Input Group */
.copier-group {
    display: flex;
    max-width: 320px;
    background-color: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.copier-url-input {
    border: none;
    background: transparent;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 12px;
    flex: 1;
    width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    outline: none;
}

.copier-btn {
    border: none;
    border-left: 1px solid var(--border-color);
    background-color: var(--bg-surface-hover);
    color: var(--text-main);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.copier-btn:hover {
    background-color: var(--primary);
    color: #fff;
}

/* System Form file selection styles */
.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Dialog layout structures */
.dialog-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    margin: 40px auto;
}

.dialog-header {
    margin-bottom: 20px;
}

.dialog-header h3 {
    font-size: 20px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

/* Toast styling for clipboard copy feedback */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--bg-surface);
    border: 1px solid var(--success);
    color: var(--text-main);
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s 2.2s forwards;
}

.toast::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--success);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
}

/* Keyframes animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); visibility: hidden; }
}

/* Footer layout */
footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: auto;
}

/* Responsive queries */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
        gap: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .actions-cell {
        margin-top: 5px;
    }
}

/* Horizontal Filters & Badges */
.filters-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 12px 26px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-btn .btn-logo {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-main);
}

.filter-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.filter-btn .btn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
    border: 2px solid var(--bg-main);
}

