
:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fdba74;
    --bg-color: #fff7ed;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --glass-blur: blur(12px);
    --nav-height: 70px;
}

[data-theme="light-orange"] { --primary: #f97316; --primary-dark: #ea580c; --bg-color: #fff7ed; --card-bg: rgba(255,255,255,0.9); --text-main: #0f172a; --text-muted: #64748b; --border: rgba(0,0,0,0.1); --input-bg: rgba(0,0,0,0.05); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.1); }
[data-theme="light-blue"] { --primary: #0ea5e9; --primary-dark: #0284c7; --bg-color: #f0f9ff; --card-bg: rgba(255,255,255,0.9); --text-main: #0f172a; --text-muted: #64748b; --border: rgba(0,0,0,0.1); --input-bg: rgba(0,0,0,0.05); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.1); }
[data-theme="light-green"] { --primary: #10b981; --primary-dark: #059669; --bg-color: #ecfdf5; --card-bg: rgba(255,255,255,0.9); --text-main: #0f172a; --text-muted: #64748b; --border: rgba(0,0,0,0.1); --input-bg: rgba(0,0,0,0.05); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.1); }
[data-theme="light-purple"] { --primary: #8b5cf6; --primary-dark: #7c3aed; --bg-color: #f5f3ff; --card-bg: rgba(255,255,255,0.9); --text-main: #0f172a; --text-muted: #64748b; --border: rgba(0,0,0,0.1); --input-bg: rgba(0,0,0,0.05); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.1); }

[data-theme="dark-orange"] { --primary: #f97316; --primary-dark: #ea580c; --bg-color: #0f172a; --card-bg: rgba(30,41,59,0.8); --text-main: #f8fafc; --text-muted: #94a3b8; --border: rgba(255,255,255,0.1); --input-bg: rgba(0,0,0,0.2); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.37); }
[data-theme="dark-blue"] { --primary: #38bdf8; --primary-dark: #0ea5e9; --bg-color: #0f172a; --card-bg: rgba(30,41,59,0.8); --text-main: #f8fafc; --text-muted: #94a3b8; --border: rgba(255,255,255,0.1); --input-bg: rgba(0,0,0,0.2); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.37); }
[data-theme="dark-green"] { --primary: #34d399; --primary-dark: #10b981; --bg-color: #0f172a; --card-bg: rgba(30,41,59,0.8); --text-main: #f8fafc; --text-muted: #94a3b8; --border: rgba(255,255,255,0.1); --input-bg: rgba(0,0,0,0.2); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.37); }
[data-theme="dark-purple"] { --primary: #a78bfa; --primary-dark: #8b5cf6; --bg-color: #0f172a; --card-bg: rgba(30,41,59,0.8); --text-main: #f8fafc; --text-muted: #94a3b8; --border: rgba(255,255,255,0.1); --input-bg: rgba(0,0,0,0.2); --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.37); }

.theme-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.theme-circle:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
}


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

body {
    font-family: 'Outfit', 'Prompt', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, #38bdf8, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Auth Section */
.nav-auth {
    display: flex;
    align-items: center;
}

.nav-loader {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-login {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login img {
    width: 20px;
    height: 20px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
}

/* Main Container */
.main-container {
    max-width: 900px;
    margin: calc(var(--nav-height) + 40px) auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

/* Glass Banner (Security Warning) */
.glass-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    animation: pulseBorder 2s infinite;
}

.banner-icon {
    font-size: 1.5rem;
}

.banner-text {
    font-size: 0.95rem;
    color: #fca5a5;
}

/* Dashboard Card */
.dashboard-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--glass-shadow);
    margin-bottom: 30px;
}

/* Segmented Controls */
.mode-selector {
    display: flex;
    background: var(--input-bg);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover:not(:disabled) {
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--primary);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

input[type="url"],
input[type="text"] {
    width: 100%;
    padding: 18px 24px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alias Wrapper */
.alias-wrapper {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.alias-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.alias-prefix {
    padding: 18px 0 18px 24px;
    color: var(--text-muted);
    font-size: 1.1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.alias-wrapper input {
    background: transparent;
    border: none;
    border-radius: 0;
}
.alias-wrapper input:focus {
    box-shadow: none;
}

/* QR Options Panel */
.qr-options-panel {
    background: var(--input-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-title {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.qr-control label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.color-picker-wrapper {
    position: relative;
    width: 100%;
    height: 45px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

input[type="color"] {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    cursor: pointer;
    border: none;
}

.file-input {
    width: 100%;
    padding: 10px;
    font-size: 0.8rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 8px;
    cursor: pointer;
}

/* Generate Button */
.btn-generate {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-main);
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
}

.btn-generate:disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Result Section */
.result-card {
    background: var(--card-bg);
    border: 1px solid var(--primary-light);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.15);
    animation: slideUp 0.5s ease;
}

.result-title {
    text-align: center;
    color: var(--primary-light);
    margin-bottom: 30px;
}

.result-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

@media(min-width: 768px) {
    /* Removed grid-template-columns as we now use flex */
}

.result-item {
    flex: 1 1 300px;
    max-width: 500px;
    background: var(--input-bg);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
}

.result-item h3 {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.copy-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortlink-text {
    font-size: 1.2rem;
    color: #38bdf8;
    text-decoration: none;
    word-break: break-all;
    padding: 15px;
    background: rgba(56, 189, 248, 0.1);
    border-radius: 8px;
    transition: background 0.3s;
}

.shortlink-text:hover {
    background: rgba(56, 189, 248, 0.2);
}

.btn-copy, .btn-download {
    padding: 12px;
    background: white;
    color: black;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-copy:hover, .btn-download:hover {
    background: #e2e8f0;
}

.qr-canvas-wrapper {
    background: white;
    padding: 20px;
    border-radius: 16px;
    display: inline-block;
    margin-bottom: 15px;
}

/* History Section */
.history-section {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--glass-shadow);
}

.table-responsive {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.history-table th, .history-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

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

.history-table a {
    color: #38bdf8;
    text-decoration: none;
}

.history-table a:hover {
    text-decoration: underline;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-both { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.badge-shortlink { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.badge-qrcode { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }

/* Utilities & Animations */
.hidden {
    display: none !important;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

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

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

/* =========================================
   Responsive Design (Tablets & Mobile)
   ========================================= */

@media (max-width: 992px) {
    .main-container {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        padding: 10px 1rem;
        height: auto;
        min-height: var(--nav-height);
        gap: 10px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .nav-right {
        display: contents;
    }

    .nav-auth {
        order: 2;
    }

    .theme-picker {
        order: 3;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .theme-selector {
        display: flex;
        flex-wrap: wrap;
        gap: 4px !important;
        justify-content: center;
    }

    .user-profile {
        gap: 8px;
    }
    
    .user-name {
        display: none; /* Hide name to save space */
    }
    
    .btn-logout {
        text-align: right;
    }
    
    .main-container {
        margin-top: 130px; /* Increase margin since navbar is now taller on mobile */
    }
    
    .dashboard-card {
        padding: 20px;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .alias-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .alias-prefix {
        padding: 12px;
        font-size: 1rem;
        background: rgba(0,0,0,0.02);
        border-bottom: 1px solid var(--border);
        text-align: center;
    }
    
    .alias-wrapper input {
        padding: 12px;
        text-align: center;
    }
    
    input[type="url"],
    input[type="text"] {
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .qr-options-panel {
        padding: 15px;
    }
    
    .qr-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-generate {
        padding: 15px;
        font-size: 1.1rem;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .history-section {
        padding: 20px;
    }
    
    .history-table th, .history-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    /* Make table scrollable but hide some columns if too narrow? 
       Using table-responsive allows scrolling which is good. */
}

@media (max-width: 480px) {
    .btn-login {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .btn-login img {
        width: 16px;
        height: 16px;
    }
}


/* Logo Gallery */
.logo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}
.logo-thumbnail-wrapper {
    position: relative;
    display: inline-block;
}
.logo-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid transparent;
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.logo-thumbnail:hover {
    transform: scale(1.05);
}
.logo-thumbnail.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}
.logo-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s;
}
.logo-thumbnail-wrapper:hover .logo-delete-btn {
    opacity: 1;
}
