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

:root {
    --primary: #fa3333;
    --primary-dark: #d42a2a;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-input: #1a1a1a;
    --text-white: #ffffff;
    --text-gray: #888888;
    --border: #2a2a2a;
    --success: #22c55e;
    --warning: #f59e0b;
    --font-body: 'Montserrat', sans-serif;
    --font-brand: 'Exo 2', sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.ibw-logo {
    height: 40px;
    width: auto;
}

.machina-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-brand);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 3px;
}

.burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.burger-btn span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--text-white);
    transition: all 0.3s ease;
}

.burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-btn.active span:nth-child(2) {
    opacity: 0;
}

.burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar {
    position: fixed;
    top: 71px;
    right: -280px;
    width: 280px;
    height: calc(100vh - 71px);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    transition: right 0.3s ease;
    z-index: 99;
    padding: 20px;
}

.sidebar.active {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 71px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 98;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-links {
    list-style: none;
    margin-top: 20px;
}

.sidebar-links li {
    margin-bottom: 5px;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    color: var(--text-white);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-links a:hover {
    background: var(--bg-input);
    color: var(--primary);
}

.sidebar-links svg {
    width: 20px;
    height: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.social-links a {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.main {
    padding: 91px 20px 40px;
    max-width: 500px;
    margin: 0 auto;
}

.hero {
    text-align: center;
    margin-bottom: 30px;
}

.hero h1 {
    font-family: var(--font-brand);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

.form-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

.form-group input:not(.country-code):not(.otp-input) {
    width: 100%;
    padding: 15px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:not(.country-code):not(.otp-input):focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input:not(.country-code)::placeholder {
    color: #555;
}

.form-group input.error {
    border-color: var(--primary);
}

.phone-input-wrapper {
    display: flex;
    gap: 10px;
}

.country-code {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    max-width: 85px !important;
    padding: 15px 10px !important;
    flex-shrink: 0;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-gray) !important;
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: default;
    pointer-events: none;
    user-select: none;
}

.country-code .flag {
    font-size: 1.1rem;
    line-height: 1;
}

.phone-input-wrapper input[type="tel"] {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 15px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 1rem;
}

.phone-input-wrapper input[type="tel"]:focus {
    outline: none;
    border-color: var(--primary);
}

.phone-input-wrapper input[type="tel"]::placeholder {
    color: #555;
}

.btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
}

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

.otp-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
}

.otp-input {
    width: 45px;
    height: 55px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-white);
    font-family: var(--font-brand);
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary);
}

.resend-otp {
    text-align: center;
    margin-top: 20px;
}

.resend-otp button {
    background: none;
    border: none;
    color: var(--primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

.resend-otp button:disabled {
    color: var(--text-gray);
    cursor: not-allowed;
}

.timer {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-top: 5px;
}

.success-screen {
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    animation: scaleIn 0.5s ease;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.coupon-code {
    background: linear-gradient(135deg, var(--bg-input) 0%, #1f1f1f 100%);
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 20px;
    margin: 25px 0;
}

.coupon-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.coupon-value {
    font-family: var(--font-brand);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}

.copy-btn {
    margin-top: 15px;
    padding: 12px 25px;
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.success-note {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-top: 20px;
    line-height: 1.6;
}

.terms-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 15px;
    text-decoration: underline;
    transition: color 0.2s ease;
}

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

.terms-modal {
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.terms-modal .modal-title {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.terms-content {
    text-align: left;
}

.terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.terms-list li {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.terms-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.terms-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(250, 51, 51, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.terms-list strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-white);
}

.terms-list p {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.5;
    margin: 0;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--border);
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

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

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-icon.error {
    background: rgba(250, 51, 51, 0.15);
    color: var(--primary);
}

.modal-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.modal-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.modal-icon.loading {
    background: rgba(250, 51, 51, 0.15);
}

.modal-icon svg {
    width: 30px;
    height: 30px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
}

.modal-message {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Debug output styling */
.modal-message:has(br) {
    text-align: left;
    font-size: 0.8rem;
    font-family: monospace;
    background: var(--bg-input);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.modal-btn {
    margin-top: 25px;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(250, 51, 51, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn .spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

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

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

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

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

/* Theme Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-top: 20px;
    background: var(--bg-input);
    border-radius: 8px;
}

.theme-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-white);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text-white);
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

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

/* Light Mode Styles */
body.light-mode {
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --bg-input: #f0f0f0;
    --text-white: #1a1a1a;
    --text-gray: #666666;
    --border: #e0e0e0;
}

body.light-mode .header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-mode .sidebar {
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

body.light-mode .burger-btn span {
    background: #1a1a1a;
}

body.light-mode .otp-input {
    background: #f0f0f0;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

body.light-mode .form-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body.light-mode .modal {
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body.light-mode .country-code {
    background: #f0f0f0;
    border-color: #e0e0e0;
}

body.light-mode .phone-input-wrapper input[type="tel"] {
    background: #f0f0f0;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

body.light-mode .phone-input-wrapper input[type="tel"]::placeholder {
    color: #999;
}

body.light-mode .form-group input:not(.country-code):not(.otp-input)::placeholder {
    color: #999;
}

/* Copyright */
.copyright {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Phone Warning */
.phone-warning {
    font-size: 0.75rem;
    color: var(--warning);
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.phone-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Light Mode Button Fix */
body.light-mode .btn {
    color: white;
}

body.light-mode .copy-btn {
    color: var(--primary);
}

body.light-mode .copy-btn:hover {
    color: white;
}

@media (min-width: 768px) {
    .main {
        padding-top: 120px;
    }
    .hero h1 {
        font-size: 2.2rem;
    }
}
