:root {
    --color-primary: #0A1628;
    --color-accent: #00D4FF;
    --color-secondary: #6366F1;
    --color-bg: #0F172A;
    --color-sidebar: rgba(10, 22, 40, 0.8);
    --color-card: rgba(255, 255, 255, 0.05);
    --color-text: #ffffff;
    --color-text-muted: #94a3b8;
    --color-border: rgba(255, 255, 255, 0.1);
    --gradient-primary: linear-gradient(135deg, #00D4FF 0%, #6366F1 100%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0A1628 0%, #0F172A 100%);
    color: var(--color-text);
    line-height: 1.6;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--color-sidebar);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--color-border);
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    text-align: center;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--color-card);
    color: var(--color-accent);
}

.nav-icon {
    font-size: 1.2rem;
}

.user-info {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.user-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.user-plan {
    font-size: 0.875rem;
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gradient-primary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Cards - Enhanced */
.card {
    background: var(--color-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    /* Increased from 1.5rem */
    margin-bottom: 2rem;
    /* Increased from 1.5rem */
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    /* Increased from 1rem */
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    /* Increased */
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons - Enhanced */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    /* Slightly larger */
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 212, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: rgba(0, 212, 255, 0.05);
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
}

.btn-outline:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00D4FF;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Table - Enhanced */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-bottom: 2px solid var(--color-border);
}

th {
    text-align: left;
    padding: 1.25rem 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

th.center,
td.center {
    text-align: center;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: all 0.2s;
}

tbody tr {
    transition: all 0.2s;
}

/* Zebra striping */
tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Hover effect */
tbody tr:hover {
    background: rgba(0, 212, 255, 0.05);
    transform: scale(1.01);
}

tbody tr:hover td {
    border-color: rgba(0, 212, 255, 0.2);
}

.url-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.url-link:hover {
    text-decoration: underline;
    color: #00D4FF;
}

.url-link-muted {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.url-link-muted:hover {
    color: var(--color-text);
}

.url-original {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.08);
}

/* Modal - Enhanced */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

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

body.modal-open {
    overflow: hidden;
}


/* Skeleton Loaders */
.loading-skeleton table {
    position: relative;
}

.loading-skeleton table::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.03) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Auto-save Indicator */
.autosave-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    display: none;
    animation: slideInRight 0.3s ease;
}

.autosave-indicator.success {
    background: linear-gradient(135deg, #22C55E, #16A34A);
    color: white;
}

.autosave-indicator.error {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
}

/* Enhanced Form States */
input.valid,
textarea.valid {
    border-color: #22C55E !important;
    background: rgba(34, 197, 94, 0.05) !important;
}

input.error,
textarea.error {
    border-color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
    animation: shake 0.3s ease;
}

@keyframes shake {

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

    25% {
        transform: translate(-5px, 0);
    }

    75% {
        transform: translate(5px, 0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes highlight {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, transform, opacity;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Disable transitions on buttons to avoid conflicts with ripple */
.btn,
.btn * {
    transition-property: none;
}

.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}


/* Toast Notifications - Floating System */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: slideInRight 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: right;
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.toast-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

.toast-close {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.25rem;
    line-height: 1;
}

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

/* Toast Types */
.toast-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.95), rgba(99, 102, 241, 0.95));
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.95));
    color: white;
}

/* Toast Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }

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

@keyframes slideOutRight {
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
}

/* Old Alert Styles - Hidden (keep for backward compatibility) */
.alert {
    display: none !important;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Hamburger Menu (Mobile Only) */
.hamburger {
    display: none;
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 9999;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.hamburger-icon {
    width: 24px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-icon span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.hamburger.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 5rem 1rem 1rem;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.5rem;
    }

    /* Stats Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    /* Cards Mobile */
    .card {
        padding: 1.5rem;
    }

    /* Tables to Card View */
    .table-container {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        margin-bottom: 1.5rem;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 1rem;
        background: var(--color-card);
    }

    tbody tr:hover {
        transform: none;
    }

    tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border: none;
        border-bottom: 1px solid var(--color-border);
    }

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

    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }

    .url-original {
        max-width: 180px;
    }

    .actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    /* Modal Mobile */
    .modal-card {
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
    }

    .modal-title {
        font-size: 1.25rem;
    }

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

    .modal-actions .btn {
        width: 100%;
    }

    /* Buttons Mobile */
    .btn {
        padding: 0.75rem 1.25rem;
    }

    /* Toast Mobile */
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Forms Mobile */
    .form-group {
        margin-bottom: 1.25rem;
    }

    input,
    textarea,
    select {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Tablet Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-link {
        padding: 1rem;
    }

    /* Remove hover effects on touch devices */
    .card:hover,
    .stat-card:hover,
    tbody tr:hover {
        transform: none;
        border-color: var(--color-border);
    }

    /* Focus states for touch */
    .btn:active {
        transform: scale(0.98);
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        padding: 4rem 1rem 1rem;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .hamburger,
    .mobile-overlay,
    .btn,
    .toast-container {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    body {
        background: white;
        color: black;
    }
}