:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: rgba(20, 20, 30, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.07);
    --accent-red: #ff334b;
    --accent-red-hover: #ff556b;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --success: #10b981;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-sans: 'Outfit', 'Inter', -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 51, 75, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 51, 75, 0.05) 0%, transparent 40%);
    display: flex;
    flex-direction: column;
}

/* Authentication Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.auth-logo img {
    height: 50px;
    filter: drop-shadow(0 0 10px rgba(255, 51, 75, 0.4));
}

.auth-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(255, 51, 75, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-red);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(255, 51, 75, 0.3);
}

.btn:hover {
    background: var(--accent-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 75, 0.4);
}

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

.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 10px;
    min-height: 18px;
}

/* Dashboard Layout */
.dashboard-header {
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-section span {
    color: var(--accent-red);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 18px;
    border-radius: 10px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--text-muted);
}

.dashboard-main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 40px auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* Sidebar navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: var(--glass-bg);
}

.nav-item.active {
    background: rgba(255, 51, 75, 0.1);
    color: var(--accent-red);
    border-left: 3px solid var(--accent-red);
    border-radius: 4px 12px 12px 4px;
}

/* Dashboard Content Grid */
.content-area {
    animation: fadeIn 0.4s ease-out;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.widget-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.widget-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 51, 75, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.widget-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
}

.widget-icon-wrap img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

/* Switch on/off style */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--glass-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-red);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.settings-group {
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    margin-top: 16px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.setting-row.checkbox-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.setting-row label {
    font-size: 13px;
    color: var(--text-muted);
}

.inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.config-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

/* Modal and Tilda Integration code block */
.integration-section {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-top: 30px;
}

.integration-section h3 {
    margin-bottom: 12px;
}

.code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #34d399;
    overflow-x: auto;
    white-space: pre;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-sans);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.alert-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(20, 20, 30, 0.95);
    border-left: 4px solid var(--accent-red);
    padding: 16px 24px;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

/* Responsiveness */
@media(max-width: 992px) {
    .dashboard-main {
        grid-template-columns: 1fr;
        margin: 20px auto;
        padding: 0 20px;
        gap: 20px;
    }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--glass-border);
    }
    .nav-item {
        white-space: nowrap;
    }
}

@media(max-width: 576px) {
    .dashboard-header {
        padding: 12px 20px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .page-title {
        font-size: 22px;
        margin-bottom: 16px;
    }
    .auth-card {
        padding: 30px 20px;
    }
    .widgets-grid {
        grid-template-columns: 1fr;
    }
    .config-footer {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    .config-footer button {
        width: 100%;
    }
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    padding: 30px;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

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

/* Delete Widget icon button */
.delete-widget-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 10;
}

.delete-widget-btn:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

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