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

html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

/* Скрываем scrollbar для Chrome, Safari и Opera */
html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #f5f5f5;
    padding: 0;
    line-height: 1.6;
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

/* Скрываем scrollbar для Chrome, Safari и Opera */
body::-webkit-scrollbar {
    display: none;
}

* {
    font-family: 'Roboto', sans-serif;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 16px;
    position: relative;
    min-height: 100vh;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 500;
    padding: 0 4px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.required {
    color: #e53935;
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: #4CAF50;
    scroll-margin-bottom: 100px;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 32px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
    touch-action: manipulation;
}

.file-upload-label:hover {
    border-color: #4CAF50;
    background: #f0f8f0;
}

.file-upload-label.has-file {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.file-name {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: #e53935;
    transition: all 0.2s;
}

.photo-remove:hover {
    background: #e53935;
    color: white;
    border-color: #e53935;
}

.platform-audience {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    font-weight: 400;
}

.platforms-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.platform-checkbox {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    min-height: 70px;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.platform-checkbox:hover {
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.platform-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.platform-checkbox:has(input:checked) {
    border-color: #e0e0e0;
    background: white;
}

.platform-checkbox:has(input:checked)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 50%;
    z-index: 10;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 14px 14px;
    background-position: center;
    background-repeat: no-repeat;
}

.platform-checkbox label {
    margin: 0;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-width: 0;
}

.platform-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin: 0;
    padding: 0;
    display: block;
    flex-shrink: 0;
}

.platform-name {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    flex-shrink: 0;
}

.platform-audience {
    font-size: 12px;
    color: #999;
    font-weight: 400;
    flex-shrink: 0;
    margin-left: 4px;
}

.platform-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 20;
    margin-right: 44px;
}

.platform-link:hover {
    background: #f0f0f0;
    color: #4CAF50;
}

.submit-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 760px;
    padding: 16px 24px;
    background: #ccc;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: not-allowed;
    transition: background 0.3s;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    touch-action: manipulation;
}

.submit-btn.valid {
    background: #4CAF50;
    cursor: pointer;
}

.submit-btn.valid:hover {
    background: #45a049;
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.form-container {
    padding-bottom: 80px;
}

/* Отступ при фокусе на полях ввода, чтобы плавающая кнопка не перекрывала */
input[type="text"],
input[type="number"],
textarea {
    scroll-margin-bottom: 100px;
}

/* Увеличенный отступ для полей контактов */
.contact-field-wrapper input[type="text"] {
    scroll-margin-bottom: 120px;
}

/* Стили для чекбоксов контактов */
.contact-checkbox-wrapper {
    margin-bottom: 15px;
}

.contact-checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.contact-checkbox-item:hover {
    background: #f5f5f5;
}

.contact-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.contact-field-wrapper {
    margin-bottom: 10px;
}

.telegram-input-wrapper {
    position: relative;
    display: block;
}

.telegram-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    z-index: 1;
    font-size: 16px;
    line-height: 1;
    display: inline-block;
}

.telegram-input {
    padding-left: 32px !important;
    width: 100%;
}

@media (min-width: 768px) {
    .container {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        padding: 30px;
        margin: 20px auto;
        min-height: auto;
    }
    
    .photos-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
    
    .submit-btn {
        bottom: 20px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 760px;
        padding: 16px 24px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .form-container {
        padding-bottom: 100px;
    }
}

.message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #e53935;
}

.message-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.message.show {
    display: block;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.success-screen {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.success-screen.show {
    display: block;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #4CAF50;
}

.success-title {
    font-size: 24px;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
}

.success-text {
    color: #666;
    margin-bottom: 30px;
}

.new-ad-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s;
}

.new-ad-btn:hover {
    background: #45a049;
}

.form-container {
    display: block;
}

.form-container.hidden {
    display: none;
}

/* Темная тема */
body.dark-theme {
    background: #000000;
}

body.dark-theme .container {
    background: #000000;
}

body.dark-theme h1 {
    color: #ffffff;
}

body.dark-theme label {
    color: #ffffff;
}

body.dark-theme input[type="text"],
body.dark-theme input[type="number"],
body.dark-theme textarea {
    background: #1a1a1a;
    border-color: #333333;
    color: #ffffff;
}

body.dark-theme input[type="text"]:focus,
body.dark-theme input[type="number"]:focus,
body.dark-theme textarea:focus {
    border-color: #4CAF50;
    background: #1a1a1a;
}

body.dark-theme .help-text {
    color: #999999;
}

body.dark-theme .file-upload-label {
    background: #1a1a1a;
    border-color: #333333;
    color: #ffffff;
}

body.dark-theme .file-upload-label:hover {
    background: #252525;
    border-color: #4CAF50;
}

body.dark-theme .file-upload-label.has-file {
    background: #1a3a1a;
    border-color: #4CAF50;
}

body.dark-theme .photo-item {
    border-color: #333333;
}

body.dark-theme .platform-checkbox {
    background: #1a1a1a;
    border-color: #333333;
}

body.dark-theme .platform-checkbox:hover {
    border-color: #4CAF50;
    background: #252525;
}

body.dark-theme .platform-name {
    color: #ffffff;
}

body.dark-theme .platform-audience {
    color: #999999;
}

body.dark-theme .platform-link {
    color: #999999;
}

body.dark-theme .platform-link:hover {
    background: #333333;
    color: #4CAF50;
}

body.dark-theme .contact-checkbox-item {
    color: #ffffff;
}

body.dark-theme .contact-checkbox-item:hover {
    background: #1a1a1a;
}

body.dark-theme .telegram-prefix {
    color: #999999;
}

body.dark-theme .message.success {
    background: #1a3a1a;
    color: #81c784;
    border-color: #4CAF50;
}

body.dark-theme .message.error {
    background: #3a1a1a;
    color: #e57373;
    border-color: #e53935;
}

body.dark-theme .success-screen {
    color: #ffffff;
}

body.dark-theme .success-title {
    color: #ffffff;
}

body.dark-theme .success-text {
    color: #999999;
}

body.dark-theme .submit-btn {
    background: #2a2a2a;
    color: #ffffff;
}

body.dark-theme .submit-btn.valid {
    background: #4CAF50;
}

body.dark-theme .submit-btn.valid:hover {
    background: #45a049;
}

body.dark-theme .submit-btn:disabled {
    background: #2a2a2a;
}

