/* ================================================
   PORTAL MONTE CARLO — Premium Dark Theme
   ================================================ */

/* === CSS Variables === */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --gold: #C5A572;
    --gold-dark: #8B7355;
    --gold-light: #D4BA8A;
    --gold-glow: rgba(197, 165, 114, 0.15);
    --gold-border: rgba(197, 165, 114, 0.2);
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(197, 165, 114, 0.1);
    --shadow-glow: 0 0 20px rgba(197, 165, 114, 0.15);
}

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Animations === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(197, 165, 114, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(197, 165, 114, 0); }
}

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

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

/* === Header === */
.portal-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--gold-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    transition: var(--transition);
}

.header-brand:hover {
    opacity: 0.9;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    font-weight: 400;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

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

.nav-link i {
    font-size: 14px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--bg-primary);
}

.user-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Toast Messages === */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    animation: toastIn 0.4s ease-out;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 420px;
}

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

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

.toast-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93C5FD;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: var(--transition);
    margin-left: auto;
}

.toast-close:hover {
    opacity: 1;
}

/* === Main Content === */
.main-content {
    flex: 1;
    animation: fadeIn 0.5s ease-out;
}

/* === Home Page === */
.home-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeInUp 0.6s ease-out;
}

.welcome-title {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.gold-text {
    color: var(--gold);
    font-weight: 600;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
}

/* === Search === */
.search-container {
    max-width: 560px;
    margin: 28px auto 0;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.search-clear {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.search-clear:hover {
    color: var(--text-primary);
}

/* === Card Sections === */
.card-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.card-section:nth-child(2) { animation-delay: 0.1s; }
.card-section:nth-child(3) { animation-delay: 0.2s; }
.card-section:nth-child(4) { animation-delay: 0.3s; }
.card-section:nth-child(5) { animation-delay: 0.4s; }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.section-icon {
    font-size: 18px;
    color: var(--gold);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--gold-border), transparent);
}

/* === App Cards Grid === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    justify-content: start;
    min-height: 120px;
}

.app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    min-height: unset;
}

.btn-remove-fav {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    opacity: 0;
    transition: var(--transition);
    z-index: 10;
}

.app-card:hover .btn-remove-fav {
    opacity: 1;
}

.btn-remove-fav:hover {
    color: #FCA5A5;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-card-hover);
    animation: fadeInUp 0.3s ease-out;
}

.text-center {
    text-align: center;
}

.app-card:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    flex-shrink: 0;
    border: 1px solid var(--gold-border);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.app-card:hover .card-icon-wrapper {
    transform: scale(1.05);
    border-color: var(--gold);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.8), var(--shadow-glow);
}

.card-icon {
    font-size: 30px;
    color: var(--gold);
    filter: drop-shadow(0 2px 8px rgba(197, 165, 114, 0.4));
}

.card-icon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    /* Convert black/white images to gold using CSS filters (approximation of #C5A572) */
    filter: brightness(0) saturate(100%) invert(75%) sepia(21%) saturate(928%) hue-rotate(352deg) brightness(87%) contrast(85%) drop-shadow(0 2px 6px rgba(197, 165, 114, 0.3));
}

.card-content {
    flex: 1;
    width: 100%;
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInUp 0.6s ease-out;
}

.empty-icon {
    font-size: 56px;
    color: var(--gold-dark);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 15px;
}

.empty-state-admin {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--gold-border);
    border-radius: var(--radius-lg);
}

.empty-state-admin h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.empty-state-admin p {
    color: var(--text-muted);
    font-size: 14px;
}

/* === Admin Container === */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px 60px;
    animation: fadeInUp 0.5s ease-out;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 20px;
    flex-wrap: wrap;
}

.admin-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-title i {
    color: var(--gold);
    font-size: 22px;
}

.admin-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--bg-primary);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* === Admin Table === */
.admin-table-container {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: rgba(197, 165, 114, 0.06);
}

.admin-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gold-border);
}

.admin-table td {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.text-muted {
    color: var(--text-muted) !important;
}

.app-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-cell-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--gold-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-cell-icon i {
    color: var(--gold);
    font-size: 14px;
}

.app-cell-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.app-cell-url {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-glow);
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.12);
    color: #6EE7B7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.12);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* === Action Buttons === */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-edit:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93C5FD;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #FCD34D;
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6EE7B7;
}

/* === Form Styles === */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 114, 0.1);
    background: rgba(255, 255, 255, 0.06);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.color-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-color {
    width: 42px;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

.form-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* === Checkbox & Check Groups === */
.form-check-group {
    display: flex;
    gap: 24px;
    padding-top: 26px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check-input {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
    cursor: pointer;
}

.form-check-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* === Validation === */
.validation-summary {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #FCA5A5;
    font-size: 13px;
}

.validation-message {
    display: block;
    color: #FCA5A5;
    font-size: 12px;
    margin-top: 4px;
}

/* === Form Section (Groups) === */
.form-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    color: var(--gold);
}

.form-section-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.group-check-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.group-check-card input[type="checkbox"] {
    display: none;
}

.group-check-card i {
    font-size: 20px;
    color: var(--text-muted);
    transition: var(--transition);
}

.group-check-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.group-check-card.selected {
    background: var(--gold-glow);
    border-color: rgba(197, 165, 114, 0.4);
}

.group-check-card.selected i {
    color: var(--gold);
}

.group-check-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.group-check-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* === Form Actions === */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 24px;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.page-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.page-link.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--bg-primary);
    border-color: transparent;
    font-weight: 600;
}

/* === Footer === */
.portal-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding: 20px 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .header-content {
        padding: 0 20px;
    }

    .nav-link span {
        display: none;
    }

    .nav-link {
        padding: 8px 12px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        height: 56px;
    }

    .brand-text {
        display: none;
    }

    .user-name {
        display: none;
    }

    .home-container,
    .admin-container {
        padding: 24px 16px 40px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
    }

    .admin-table-container {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 600px;
    }

    .form-check-group {
        flex-direction: column;
        gap: 12px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        justify-content: center;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-nav {
        gap: 2px;
    }

    .nav-link {
        padding: 8px;
        font-size: 16px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .search-input {
        padding: 12px 44px;
        font-size: 13px;
    }
}

/* ============================================
   BULK ACTIONS
   ============================================ */
.bulk-action-bar {
    position: fixed;
    bottom: -80px;
    left: 0;
    right: 0;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--gold-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.bulk-action-bar.active {
    bottom: 0;
}
.bulk-action-bar .selected-count {
    color: var(--gold);
    font-weight: 600;
}
.bulk-action-bar .bulk-actions {
    display: flex;
    gap: 0.75rem;
}

/* Checkbox styling */
.form-check-input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.form-check-input[type="checkbox"]:checked {
    background-color: var(--gold);
    border-color: var(--gold);
}

/* Table row selection */
tr.selected {
    background-color: rgba(197, 165, 114, 0.08) !important;
}

/* App checkbox grid */
.app-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}
.app-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
    cursor: pointer;
}
.app-checkbox-item:hover {
    border-color: var(--gold);
    background: rgba(197, 165, 114, 0.05);
}
.app-checkbox-item.checked {
    border-color: var(--gold);
    background: rgba(197, 165, 114, 0.1);
}
.app-checkbox-item .app-name {
    font-weight: 500;
    color: var(--text-primary);
}
.app-checkbox-item .app-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* User info card */
.user-info-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.5rem;
}
.user-info-card .info-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.user-info-card .info-item span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Bulk action modal */
.bulk-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.bulk-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.bulk-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--gold-border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}
.bulk-modal-overlay.active .bulk-modal {
    transform: scale(1);
}

/* ============================================
   AD SEARCH RESULTS
   ============================================ */
.ad-search-section {
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}
.ad-search-results {
    margin-top: 16px;
    border: 1px solid var(--gold-border);
    border-radius: 12px;
    overflow: hidden;
}
.ad-search-results .result-header {
    background: rgba(197, 165, 114, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gold-border);
}
.ad-search-results .result-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gold);
}
.badge-imported {
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
}
.badge-admin {
    background: rgba(197, 165, 114, 0.2);
    color: var(--gold);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.badge-user {
    background: rgba(100, 100, 100, 0.2);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* ============================================
   CARD BACKGROUND IMAGE
   ============================================ */
.app-card.has-bg-image {
    padding: 0;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-bg-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.app-card.has-bg-image:hover .card-bg-image img {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.card-bg-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
    pointer-events: none;
}

.card-category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    background: rgba(20, 20, 30, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(197, 165, 114, 0.3);
    letter-spacing: 0.3px;
}

.card-content-overlay {
    padding: 16px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-content-overlay .card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.card-content-overlay .card-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
