/* ==========================================
   LuminaLink Minimalist Design System
   ========================================== */
:root {
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --border-focus: #111827;
    
    --primary: #111827;
    --primary-hover: #374151;
    
    --secondary: #f3f4f6;
    --secondary-hover: #e5e7eb;

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-inverse: #ffffff;
    
    --success: #10b981;
    --danger: #ef4444;

    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --transition-smooth: all 0.2s ease-in-out;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

/* ==========================================
   Global Reset & Base Settings
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ==========================================
   App Container & Header
   ========================================== */
.app-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    animation: fadeIn 0.5s ease-out;
}

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

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

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.logo-icon {
    font-size: 1.6rem;
    color: var(--primary);
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 8px;
}

/* ==========================================
   Main Card & Navigation
   ========================================== */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    padding: 32px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 10px 16px;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active {
    color: var(--text-main);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* Tab Panels */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
    display: block;
}

/* ==========================================
   Inputs & Form Styling
   ========================================== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1rem;
}

.input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 14px 16px 14px 44px;
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 1rem;
}

.input-wrapper input::placeholder {
    color: #9ca3af;
}

/* Custom code specific */
#custom-code {
    padding-left: 8px;
}

.domain-prefix {
    padding-left: 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
    user-select: none;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    border: none;
    outline: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    padding: 14px 24px;
    width: 100%;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-main);
    padding: 10px 20px;
    border: 1px solid var(--border-color);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* ==========================================
   Result Output Card
   ========================================== */
.result-card {
    margin-top: 24px;
    padding: 24px;
    border-radius: var(--radius-md);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.result-card.open {
    display: block;
}

.success-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.success-icon {
    font-size: 1.2rem;
    color: var(--success);
}

.success-header h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: #166534;
}

.short-url-output {
    display: flex;
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.short-url-output input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 16px;
    color: #166534;
    font-weight: 600;
    font-size: 1rem;
}

.btn-copy {
    background: transparent;
    border: none;
    border-left: 1px solid #bbf7d0;
    color: #166534;
    padding: 0 16px;
    border-radius: 0;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-copy:hover {
    background: #dcfce7;
}

.result-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   Links List Table (Tab 2)
   ========================================== */
.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.manage-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-refresh {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

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

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.links-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.links-table th,
.links-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.links-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-main);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.links-table tbody tr:hover {
    background: var(--bg-main);
}

.short-link-cell {
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.short-link-cell:hover {
    text-decoration: underline;
}

.long-link-cell {
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clicks-badge {
    background: var(--bg-main);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.date-cell {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.btn-action {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-action.btn-delete-action:hover {
    color: var(--danger);
    background: #fef2f2;
    border-color: #fca5a5;
}

/* Loading & Empty States */
.list-loading,
.list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 12px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-icon {
    font-size: 2rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.list-empty p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.hidden {
    display: none !important;
}

/* ==========================================
   Modal Overlay
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.glass-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.modal-content {
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.modal-url-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 20px;
    padding: 0 10px;
}

.qr-code-wrapper {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    display: inline-block;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.qr-code-wrapper img {
    display: block;
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: var(--transition-smooth);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
}

@keyframes toastSlideIn {
    from { transform: translateX(100%) translateY(0); opacity: 0; }
    to { transform: translateX(0) translateY(0); opacity: 1; }
}

/* ==========================================
   Utilities / Keyframes
   ========================================== */
.hidden {
    display: none !important;
}

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

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

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

/* Responsive adjustments */
@media(max-width: 640px) {
    .glass-card {
        padding: 20px 15px;
    }
    
    .logo {
        font-size: 2.2rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .tabs-nav {
        flex-direction: column;
        gap: 4px;
    }
    
    .links-table th:nth-child(4),
    .links-table td:nth-child(4) {
        display: none; /* Hide date on mobile */
    }

    .long-link-cell {
        max-width: 120px;
    }
}
