/* assets/style.css - Monochrome High-End Redesign */
:root {
    --primary-black: #000000;
    --primary-white: #ffffff;
    --bg-gray: #f9fafb;
    --border-gray: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --sidebar-bg: #111827;
    --sidebar-text: #9ca3af;
    --sidebar-active: #ffffff;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-main);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#app {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-container {
    background: var(--primary-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 450px;
    position: relative;
    border: 1px solid var(--border-gray);
}

.modal-container:has(.guide-content) {
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-container:has(.guide-content) .modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-main);
    border: 1px solid var(--border-gray);
}

.btn-danger {
    background: #000;
    color: #fff;
}

/* Auth View */
.login-container {
    max-width: 400px;
    margin: auto;
    background: var(--primary-white);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.login-container h1 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

/* Dashboard Layout */
.dashboard-container {
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.main-layout {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 1.5rem 2rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--primary-white);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--primary-white);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--primary-white);
    background: rgba(255, 255, 255, 0.1);
    border-right: 3px solid var(--primary-white);
}

.nav-item i {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.icon-btn i {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-gray);
    overflow-y: auto;
}

/* Top Bar */
.top-bar {
    height: 64px;
    background: var(--primary-white);
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-gray);
    border: 1px solid var(--border-gray);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    width: 400px;
}

.search-box input {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.search-box input:focus {
    outline: none;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-black);
    color: var(--primary-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Main Sections */
.view-section {
    padding: 2rem;
    display: none;
}

.view-section.active {
    display: block;
    flex: 1;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
}

/* Guide button */
.guide-btn {
    background: transparent;
    border: 1px solid var(--border-gray);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
}

.guide-btn:hover {
    color: var(--text-main);
    border-color: var(--text-main);
    background: var(--bg-gray);
}

.guide-btn i {
    width: 18px;
    height: 18px;
}

.guide-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 1.25rem 0 0.5rem 0;
    color: var(--text-main);
}

.guide-content h3:first-child {
    margin-top: 0;
}

.guide-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 0.5rem 0;
}

.guide-content ol {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.8;
    padding-left: 1.25rem;
    margin: 0 0 0.75rem 0;
}

.guide-content .guide-tip {
    background: var(--bg-gray);
    border-left: 3px solid var(--primary-black);
    padding: 0.6rem 1rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    color: var(--text-main);
    margin: 0.75rem 0;
}

/* Creation Box */
.creation-card {
    background: var(--primary-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-gray);
}

.creation-card h2 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.creation-card.coupon-form {
    padding: 2.5rem 3rem;
}

.field-label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

.coupon-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 2.5rem;
    row-gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.coupon-row:has(> :nth-child(4)) {
    grid-template-columns: repeat(4, 1fr);
}

.coupon-toggles {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 500;
}

.toggle-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary-black);
    cursor: pointer;
}

.coupon-expand-panel {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-gray);
    border-radius: 8px;
    border: 1px dashed var(--border-gray);
}

.input-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    column-gap: 2rem;
    row-gap: 1.25rem;
    align-items: end;
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary-black);
    outline: none;
}

input[type="checkbox"] {
    width: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    cursor: pointer;
    accent-color: var(--primary-black);
}

/* Multi-select dropdown component */
.multi-dropdown {
    position: relative;
}

.multi-dropdown .md-trigger {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-white);
    color: var(--text-muted);
    box-sizing: border-box;
    min-height: 40px;
    gap: 0.5rem;
}

.multi-dropdown .md-trigger.has-selection {
    color: var(--text-main);
}

.multi-dropdown .md-trigger::after {
    content: '';
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    flex-shrink: 0;
}

.multi-dropdown .md-trigger .md-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-dropdown .md-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-white);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 50;
    margin-top: 4px;
    max-height: 220px;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.multi-dropdown.open .md-panel {
    display: flex;
}

.multi-dropdown .md-search {
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border-gray);
    font-size: 0.85rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
}

.multi-dropdown .md-options {
    overflow-y: auto;
    max-height: 170px;
    padding: 0.25rem 0;
}

.multi-dropdown .md-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.multi-dropdown .md-option:hover {
    background: var(--bg-gray);
}

.multi-dropdown .md-option input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary-black);
    cursor: pointer;
}

.multi-dropdown .md-empty {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

button {
    background: var(--primary-black);
    color: var(--primary-white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

button:hover {
    opacity: 0.9;
}

/* Link Cards Grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.link-card {
    background: var(--primary-white);
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem;
    font-size: 1rem;
    border-radius: 6px;
}

.icon-btn:hover {
    background: var(--bg-gray);
    color: var(--primary-black);
}

.card-body {
    padding: 1rem 0;
}

.url-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.url-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-all;
    margin-bottom: 1rem;
}

.short-url {
    background: var(--bg-gray);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px dashed var(--border-gray);
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-black);
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-gray);
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* User List Table Style */
.user-table {
    width: 100%;
    background: var(--primary-white);
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    overflow: hidden;
    border-collapse: collapse;
}

.user-table th {
    background: var(--bg-gray);
    text-align: left;
    padding: 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-gray);
}

.user-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-gray);
    font-size: 0.9rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* List search bar */
.list-search {
    position: relative;
    width: 260px;
}

.list-search i,
.list-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
}

.list-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.list-search input:focus {
    border-color: var(--primary-black);
    outline: none;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}

th.sortable:hover {
    color: var(--primary-black);
}

th.sortable .sort-arrow {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.3;
    transition: opacity 0.15s;
}

th.sortable.sort-active .sort-arrow {
    opacity: 1;
}

/* Sync button */
.sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-white);
    color: var(--text-main);
    border: 1px solid var(--border-gray);
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.sync-btn:hover {
    background: var(--bg-gray);
    border-color: var(--text-muted);
}

.sync-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sync-btn i {
    width: 14px;
    height: 14px;
}

.sync-btn.syncing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Sub-tabs (inside sections) */
.sub-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-gray);
}

.sub-tab {
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.sub-tab:hover {
    color: var(--text-main);
    opacity: 1;
}

.sub-tab.active {
    color: var(--text-main);
    border-bottom-color: var(--primary-black);
}

.sub-tab-panel {
    display: none;
}

.sub-tab-panel.active {
    display: block;
}

/* Filter tabs (pill style) */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.filter-tab {
    background: var(--bg-gray);
    color: var(--text-muted);
    border: 1px solid var(--border-gray);
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s;
}

.filter-tab:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    opacity: 1;
}

.filter-tab.active {
    background: var(--primary-black);
    color: var(--primary-white);
    border-color: var(--primary-black);
}

.filter-tab .badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 0.35rem;
    font-weight: 700;
}

.filter-tab.active .badge {
    background: rgba(255,255,255,0.25);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border-gray);
    background: var(--primary-white);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s;
}

.pagination button:hover {
    background: var(--bg-gray);
    opacity: 1;
}

.pagination button.active {
    background: var(--primary-black);
    color: var(--primary-white);
    border-color: var(--primary-black);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination button:disabled:hover {
    background: var(--primary-white);
}

/* Bulk action bar */
.bulk-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sidebar-bg);
    color: var(--primary-white);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    z-index: 900;
    font-size: 0.875rem;
    font-weight: 600;
}

.bulk-bar button {
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
}

.bulk-bar .btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
}

/* Bulk select checkbox in cards */
.bulk-check {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-black);
    cursor: pointer;
    z-index: 2;
}

.link-card {
    position: relative;
}

.link-card.selected {
    outline: 2px solid var(--primary-black);
    outline-offset: -2px;
}

/* Bulk checkbox in tables */
.user-table .bulk-check {
    position: static;
    margin: 0;
}

.user-table tr.selected td {
    background: #f0f0f0;
}

/* Area expandable rows */
.area-row:hover {
    background: #f9f9f9;
}
.area-chevron {
    display: inline-block;
    vertical-align: middle;
}
.area-detail-row td {
    background: #fafafa;
    border-top: none !important;
}
.area-members-panel {
    padding: 1rem 1.5rem;
}
.area-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.area-member-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
}