:root {
    --bg: #020617;
    --surface: #0f172a;
    --surface-hover: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #38bdf8;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #1e293b;
    --danger: #ef4444;
    --success: #22c55e;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
    display: flex;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #020617 100%);
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, 50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 20px 50px 20px;
    /* Extra bottom padding for fixed footer */
}

.main-content {
    flex: 1;
    padding: 30px 30px 60px 30px;
    /* Extra bottom padding for fixed footer */
    overflow-y: auto;
    position: relative;
}

/* Sidebar Components */
.logo {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    color: var(--text);
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: 0.2s;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.project-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

.project-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.project-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-inactive .status-dot {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.status-inactive .status-text {
    color: var(--danger);
}

.status-active .status-dot {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-active .status-text {
    color: var(--success);
}

/* Main Content Components */
.hidden {
    display: none !important;
}

.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--primary);
}

.empty-state h2 {
    color: var(--text);
    margin-bottom: 10px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.project-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    color: var(--muted);
    vertical-align: middle;
}

.domain-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.domain-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

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

.btn-danger-text {
    background: none;
    color: var(--danger);
    padding: 10px;
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-text {
    background: none;
    color: var(--muted);
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 12px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

/* Table */
.table-container {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

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

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 15px 20px;
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.rank-change {
    font-size: 12px;
    font-weight: 600;
    margin-left: 5px;
}

.rank-up {
    color: var(--success);
}

.rank-down {
    color: var(--danger);
}

.rank-same {
    color: var(--muted);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-lg {
    width: 95%;
    max-width: 1600px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-lg .tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-lg .scrollable-table {
    flex: 1;
    max-height: none;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.scrollable-table {
    max-height: 400px;
    overflow-y: auto;
}

.clickable-keyword {
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.clickable-keyword:hover {
    color: var(--primary);
    text-decoration: underline;
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h2 {
    margin-bottom: 10px;
}

.modal-subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
}

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

.help-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 5px;
}

.help-text a {
    color: var(--primary);
    text-decoration: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}