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

:root {
    --bg-dark: #1a1a1a;
    --bg-card: #242424;
    --bg-sidebar: #1f1f1f;
    --text-white: #ffffff;
    --text-gray: #9ca3af;
    --text-dark: #1f2937;
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --white: #ffffff;
    --border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
}

.logo-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--blue);
    color: var(--white);
}

.nav-item svg {
    flex-shrink: 0;
}

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

.back-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    max-width: calc(100% - 260px);
}

/* Header */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

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

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-gray);
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 6px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--red);
}

/* Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-gray);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--blue);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 6px;
}

/* Preview Box */
.preview-box {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}

.preview-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border);
}

.preview-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.preview-username {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 12px;
}

.preview-desc {
    font-size: 14px;
    color: var(--text-gray);
    max-width: 300px;
    margin: 0 auto;
}

/* Payment List */
.payment-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.payment-list-item input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 14px;
}

.payment-list-item input:focus {
    outline: none;
    border-color: var(--blue);
}

/* Color Options */
.color-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-option {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.05);
}

.color-option.active {
    border-color: var(--white);
}

/* Toggle */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-item span {
    font-size: 14px;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-input:checked + .toggle-slider {
    background: var(--blue);
}

.toggle-input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header .section-title {
    margin-bottom: 0;
}

.toggle-item-inline {
    display: flex;
    align-items: center;
    cursor: pointer;
}

/* Button Order List */
.button-order-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.button-order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: grab;
}

.button-order-item:active {
    cursor: grabbing;
}

.button-order-item.dragging {
    opacity: 0.5;
}

.button-order-handle {
    color: var(--text-gray);
    cursor: grab;
}

.button-order-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-order-name {
    flex: 1;
    font-size: 14px;
}

.button-order-toggle {
    display: flex;
    align-items: center;
}

/* Custom Button Item */
.custom-button-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.custom-button-item input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 14px;
}

.custom-button-item input:focus {
    outline: none;
    border-color: var(--blue);
}

/* Topic Item */
.topic-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.topic-item input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 14px;
}

.topic-item input:focus {
    outline: none;
    border-color: var(--blue);
}

/* Form Range */
.form-range {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--blue);
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--blue);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.range-value {
    text-align: right;
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
}

/* Data Actions */
.data-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.data-actions .btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--green);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-out;
    z-index: 300;
}

.toast.active {
    opacity: 1;
    transform: translateY(0);
}

/* Header Left */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Header Actions Mobile */
.header-actions-mobile {
    display: none;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.header-actions-mobile .btn-secondary,
.header-actions-mobile .btn-primary {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 16px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }
    
    .header-left {
        justify-content: flex-start;
    }
    
    .header-actions {
        display: none;
    }
    
    .header-actions-mobile {
        display: flex;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .header-actions {
        width: auto;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: none;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Mobile button order */
    .button-order-item {
        padding: 14px 12px;
        gap: 10px;
    }
    
    .button-order-name {
        font-size: 13px;
    }
    
    .button-order-handle {
        font-size: 14px;
    }
    
    .button-order-icon {
        width: 28px;
        height: 28px;
    }
    
    .button-order-icon svg {
        width: 14px;
        height: 14px;
    }
    
    /* Form inputs mobile */
    .form-input,
    .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Section cards mobile */
    .section-card {
        padding: 16px;
    }
    
    .section-title {
        font-size: 14px;
    }
    
    /* Payment list mobile */
    .payment-list-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .payment-list-item input {
        width: 100%;
        font-size: 14px;
    }
    
    /* Custom button mobile */
    .custom-button-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .custom-button-item input {
        width: 100%;
        font-size: 14px;
    }
    
    /* Topic item mobile */
    .topic-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .topic-item input {
        width: 100%;
        font-size: 14px;
    }
    
    /* Color options mobile */
    .color-option {
        width: 40px;
        height: 40px;
    }
    
    /* Preview box mobile */
    .preview-box {
        padding: 20px;
    }
    
    .preview-avatar {
        width: 60px;
        height: 60px;
    }
    
    .preview-name {
        font-size: 16px;
    }
}

/* Icon Options */
.icon-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.icon-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-option:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-option input[type="radio"] {
    display: none;
}

.icon-option input[type="radio"]:checked + .icon-preview {
    border-color: var(--blue);
    background: rgba(59, 130, 246, 0.1);
}

.icon-preview {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-white);
}

.icon-option span {
    font-size: 12px;
    color: var(--text-gray);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
