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

html, body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #F6F5EE;
    padding: 15px;
    color: #000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
}

.container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 30px);
    box-sizing: border-box;
}

header {
    background: #F6F5EE;
    color: #000;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo {
    height: 75px;
    width: 75px;
    object-fit: contain;
    border-radius: 8px;
    background: white;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-text {
    text-align: left;
    flex: 1;
}

.header-text h1 {
    margin: 0;
    font-size: 2.2em;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.5px;
}

.header-badge {
    background: #F6F5EE;
    color: #000;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.header-badge:hover {
    background: #e8e6df;
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}



header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.1em;
}

main {
    padding: 20px 30px;
    flex: 1;
    overflow-x: hidden;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
}

.main-layout {
    display: block;
    margin-bottom: 20px;
    background: white;
    border-radius: 15px;
    padding: 20px 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    overflow-x: hidden;
    overflow-y: visible;
    max-width: 100%;
    box-sizing: border-box;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.section-hint {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.upload-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.btn-select {
    flex: 1;
    padding: 12px 20px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-select:hover {
    background: #000;
}

.info-box {
    background: #F6F5EE;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-toggle,
.advanced-toggle {
    cursor: pointer;
    padding: 10px;
    color: #666;
    font-weight: 500;
    margin-top: 10px;
    user-select: none;
}

.settings-toggle:hover,
.advanced-toggle:hover {
    color: #000;
}

.status-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    background: white;
    padding: 15px 18px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.status-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 0.95em;
    color: #000;
    word-break: break-all;
    font-weight: 400;
}

.upload-section {
    margin-bottom: 0;
}

.upload-section h3 {
    margin: 0 0 10px 0;
    color: #000;
    font-size: 1.2em;
    font-weight: 600;
}

.upload-area {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 15px;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.upload-area svg {
    color: #FCB02F;
    margin-bottom: 20px;
}

.upload-area h2 {
    color: #333;
    margin-bottom: 10px;
}

.upload-area p {
    color: #666;
    margin: 5px 0;
}

.hint {
    font-size: 0.9em;
    color: #999;
    margin-top: 15px;
}

.settings-section {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.settings-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
}

.setting-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.setting-group select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-group select:hover {
    border-color: rgba(0, 0, 0, 0.25);
}

.setting-group select:focus {
    outline: none;
    border-color: #FCB02F;
    box-shadow: 0 0 0 3px rgba(252, 176, 47, 0.1);
}

.advanced-settings {
    margin-top: 20px;
}

.advanced-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.advanced-header h3 {
    margin: 0;
    color: #333;
}

.optional {
    font-size: 0.85em;
    font-weight: normal;
    color: #999;
    margin-left: 10px;
}

.toggle-icon {
    font-size: 0.9em;
    color: #FCB02F;
    transition: transform 0.3s;
}

.advanced-header.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.advanced-group h4 {
    margin: 0 0 20px 0;
    color: #555;
    font-size: 1.1em;
}

.setting-hint {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.resize-options {
    margin-top: 15px;
    padding-left: 15px;
    border-left: 3px solid #e0e0e0;
}

.number-input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    width: 150px;
    transition: border-color 0.3s;
}

.number-input:focus {
    outline: none;
    border-color: #FCB02F;
}

.checkbox-group {
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: #555;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #FCB02F;
}

.quality-group {
    margin-top: 25px;
}

.quality-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.quality-slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FCB02F;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FCB02F;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.quality-input {
    width: 70px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
    font-weight: 600;
    color: #FCB02F;
    transition: border-color 0.3s;
}

.quality-input:focus {
    outline: none;
    border-color: #FCB02F;
}

.files-section {
    margin-bottom: 20px;
}

.files-section h3 {
    margin-bottom: 20px;
    color: #333;
}

#filesList {
    margin-bottom: 20px;
}

.file-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.file-item .file-info {
    flex: 1;
}

.file-item .file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.file-item .file-size {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.file-estimate {
    font-size: 0.85em;
    margin-top: 5px;
}

.estimate-text {
    color: #555;
}

.estimate-loading {
    color: #999;
    font-style: italic;
}

.estimate-error {
    color: #e74c3c;
}

.file-estimate .savings {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.file-estimate .savings.positive {
    background: #FCB02F;
    color: #000;
}

.file-estimate .savings.negative {
    background: #e74c3c;
    color: white;
}

.file-item .remove-btn {
    background: transparent;
    color: #666;
    border: none;
    padding: 5px 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5em;
    font-weight: bold;
    transition: all 0.3s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item .remove-btn:hover {
    background: #f0f0f0;
    color: #000;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary {
    background: #FCB02F;
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(252, 176, 47, 0.4);
    background: #f0a020;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#resultsSection {
    margin-top: 20px;
    order: -1;
    overflow-x: hidden;
    overflow-y: visible;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    max-width: 100%;
    box-sizing: border-box;
}

.max-size-section {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
}

.max-size-section h3 {
    margin: 0 0 15px 0;
    color: #000;
    font-size: 1.2em;
    font-weight: 600;
}

.radio-group {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #000;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

.radio-label:hover {
    background: #f8f8f8;
}

.radio-label input[type="checkbox"],
.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #FCB02F;
    border-radius: 3px;
}

.radio-label span {
    font-size: 1em;
}

.ai-seo-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.filename-section {
    margin-bottom: 15px;
}

.filename-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filename-display {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.9em;
    word-break: break-all;
}

.filename-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 2px solid #FCB02F;
    border-radius: 6px;
    font-size: 0.9em;
}

.edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    transition: transform 0.2s;
}

.edit-btn:hover {
    transform: scale(1.1);
}

.seo-info {
    margin-top: 15px;
    padding: 15px;
    background: #e8f4f8;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.seo-item {
    margin-bottom: 10px;
    font-size: 0.9em;
    line-height: 1.5;
}

.seo-item:last-child {
    margin-bottom: 0;
}

.seo-item strong {
    display: inline-block;
    min-width: 90px;
    color: #333;
}

.seo-item span {
    color: #555;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: inline-block;
}

.seo-item {
    margin-bottom: 10px;
    font-size: 0.9em;
    line-height: 1.5;
}

.seo-item:last-child {
    margin-bottom: 0;
}

.seo-item strong {
    color: #000;
    margin-right: 8px;
}

.premium-label {
    position: relative;
}

.premium-icon {
    font-size: 1.2em;
    margin-right: 8px;
    display: inline-block;
}

.premium-code-input {
    margin-top: 15px;
    padding: 15px;
    background: #fff9e6;
    border: 2px solid #FCB02F;
    border-radius: 8px;
}

.premium-code-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #000;
}

.premium-code-input input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    text-align: center;
    transition: border-color 0.3s;
}

.premium-code-input input:focus {
    outline: none;
    border-color: #FCB02F;
    box-shadow: 0 0 0 3px rgba(252, 176, 47, 0.1);
}

.code-status {
    display: block;
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: 600;
}

.code-status.valid {
    color: #2ecc71;
}

.code-status.invalid {
    color: #e74c3c;
}

#resultsSection h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.result-name {
    font-weight: 600;
    color: #333;
}

.savings {
    font-weight: 600;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
}

.savings.positive {
    background: #FCB02F;
    color: #000;
}

.savings.negative {
    background: #e74c3c;
    color: white;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    max-width: 100%;
    box-sizing: border-box;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.download-btn {
    background: #FCB02F;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    width: 100%;
    margin-top: 0;
}

.download-btn:hover {
    background: #f0a020;
}

.download-zip {
    background: #FCB02F;
    margin-top: 15px;
}

.download-zip:hover {
    background: #f0a020;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FCB02F;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
}

.upload-area {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 15px;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.upload-area h4 {
    margin: 0 0 15px 0;
    color: #000;
    font-size: 1.1em;
}

.upload-area .file-item {
    margin-bottom: 10px;
}

@media (max-width: 968px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .right-column {
        order: -1;
    }
}

@media (max-width: 968px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .right-column {
        order: -1;
    }
}

@media (max-width: 768px) {
    html, body {
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    body {
        padding: 10px;
    }
    
    .container {
        min-height: auto;
        max-height: none;
    }
    
    main {
        overflow-x: hidden;
        overflow-y: visible;
    }
    
    header {
        padding: 20px;
    }
    
    .header-content {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .header-logo {
        justify-content: center;
    }
    
    .header-text {
        text-align: center;
    }
    
    .header-text h1 {
        font-size: 1.8em;
    }
    
    .header-badge {
        justify-self: center;
    }
    
    .logo {
        height: 62px;
        width: 62px;
    }
    
    main {
        padding: 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-controls {
        flex-direction: column;
    }
}

