:root {
    --primary: var(--tg-theme-button-color, #4F46E5);
    --primary-light: var(--tg-theme-button-color, #6366F1);
    --bg-color: var(--tg-theme-secondary-bg-color, #F8FAFC);
    --card-bg: var(--tg-theme-bg-color, #FFFFFF);
    --text-main: var(--tg-theme-text-color, #1E293B);
    --text-muted: var(--tg-theme-hint-color, #64748B);
    --border-color: rgba(100, 116, 139, 0.2);
    --danger: #EF4444;
    --success: var(--tg-theme-button-color, #10B981);
    --border-radius: 16px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.08) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(99, 102, 241, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 30px; /* Reduced since no custom bottom bar */
}

/* Header */
.top-header {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: #ffffff;
    padding: 16px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}
.top-header .titles {
    flex: 1;
}
.top-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}
.top-header p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
    color: #ffffff;
}
.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    position: absolute;
    right: 16px;
    transition: 0.2s;
}
.refresh-btn:active {
    transform: scale(0.9);
}

/* Custom Bottom Button */
.bottom-button-container {
    position: fixed;
    bottom: 24px;
    left: 16px;
    right: 16px;
    z-index: 1000;
}
#custom-main-btn {
    width: 100%;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
#custom-main-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Stepper */
.stepper-container {
    background: color-mix(in srgb, var(--card-bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 58px; /* header height */
    z-index: 99;
}
.stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}
.stepper::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border-color);
    z-index: 1;
}
.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    background: var(--card-bg);
    padding: 0 4px;
    width: 60px;
}
.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.step-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}
.step-indicator.active .step-dot {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--tg-theme-button-text-color, white);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.step-indicator.active .step-label {
    color: var(--primary-light);
    font-weight: 700;
}

/* Main Container */
.container {
    max-width: 600px;
    margin: 24px auto;
    padding: 0 16px;
}

/* Slide in animation */
.step-content {
    display: none;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.step-content.active {
    display: block;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Card */
.card {
    background: color-mix(in srgb, var(--card-bg) 65%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}
.card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
}
.card-title-group h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}
.card-title-group p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    transition: 0.2s;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}
label span.req {
    color: var(--danger);
}
input[type="text"], input[type="number"], input[type="date"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    transform: scale(1.01);
}

/* Radio chips */
.radio-group {
    display: flex;
    gap: 12px;
}
.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    gap: 8px;
}
.radio-label input {
    display: none;
}
.radio-label:has(input:checked) {
    border-color: var(--primary-light);
    background: var(--primary-light);
    color: var(--tg-theme-button-text-color, white);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Dynamic lists */
.list-group {
    margin-bottom: 24px;
}
.list-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.list-group-title {
    font-size: 14px;
    font-weight: 600;
}
.list-group-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}
.btn-icon-add {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--tg-theme-button-text-color, white);
    border: none;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon-add:active {
    transform: scale(0.9);
}
.list-empty-state {
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: var(--bg-color);
}
.list-empty-state .emoji {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}
.list-empty-state p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}
.list-items .item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    animation: fadeIn 0.3s;
}
.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-remove:active {
    transform: scale(0.9);
}

/* Row inputs */
.row-inputs {
    display: flex;
    gap: 16px;
}
.row-inputs .form-group {
    flex: 1;
}

/* File Upload */
.file-drop-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: var(--bg-color);
    border: 1.5px dashed var(--border-color);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}
.file-drop-area:hover {
    background-color: var(--card-bg);
    border-color: var(--primary-light);
    transform: scale(1.02);
}
.file-drop-area.is-active {
    background-color: var(--card-bg);
    border-color: var(--primary-light);
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.file-msg {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    margin-top: 8px;
}
.file-icon {
    font-size: 32px;
    transition: 0.3s;
}
.file-drop-area:hover .file-icon {
    transform: translateY(-4px);
}
.file-input {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    cursor: pointer;
    opacity: 0;
}
