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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4285f4 0%, #ea4335 100%);
    color: white;
    padding: 50px 30px;
    text-align: center;
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.header p {
    font-size: 18px;
    opacity: 0.9;
}

.content {
    padding: 40px 30px;
}

/* Info Panel */
.info-panel {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.info-icon {
    font-size: 32px;
}

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

.info-content strong {
    display: block;
    color: #1976d2;
    font-size: 14px;
    margin-bottom: 3px;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

/* Form Section */
.form-section h2,
.preview-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

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

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.hint {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.generate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(66, 133, 244, 0.3);
}

/* Preview Section */
.ad-preview {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.ad-label {
    font-size: 13px;
    color: #5f6368;
    margin-bottom: 10px;
}

.headline-wrapper,
.description-wrapper {
    margin-bottom: 15px;
}

.headline {
    color: #1a0dab;
    font-size: 20px;
    font-weight: 400;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    min-height: 45px;
    display: flex;
    align-items: center;
}

.description {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    min-height: 60px;
}

.char-count {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.char-count .current {
    font-weight: 700;
}

.char-count.warning .current {
    color: #f57c00;
}

.char-count.error .current {
    color: #d32f2f;
}

/* Results */
.results {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
}

.results h3 {
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.result-block {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.result-block h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.result-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4285f4;
}

.result-text {
    flex: 1;
    color: #333;
    font-size: 15px;
}

.copy-btn {
    padding: 8px 16px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #357ae8;
}

.copy-btn.copied {
    background: #34a853;
}

.tips-section {
    background: #fff9c4;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #fbc02d;
}

.tips-section h4 {
    color: #333;
    margin-bottom: 12px;
}

.tips-section ul {
    list-style: none;
    margin: 0;
}

.tips-section li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

.tips-section li::before {
    content: "💡";
    position: absolute;
    left: 0;
}

.copy-all-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #34a853 0%, #4caf50 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.copy-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 168, 83, 0.3);
}

/* Templates Section */
.templates-section {
    margin-bottom: 60px;
}

.templates-section h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
    text-align: center;
}

.templates-desc {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

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

.template-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #4285f4;
}

.template-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.template-card h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 20px;
}

.template-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.use-template-btn {
    padding: 10px 20px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.use-template-btn:hover {
    background: #357ae8;
}

/* Writing Tips */
.writing-tips {
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    padding: 40px;
    border-radius: 15px;
}

.writing-tips h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    text-align: center;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.tip-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
}

.tip-number {
    position: absolute;
    top: -15px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(66, 133, 244, 0.3);
}

.tip-card h3 {
    color: #333;
    margin-bottom: 10px;
    margin-top: 10px;
    font-size: 18px;
}

.tip-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* Кнопка повернення */
.back-home-container {
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    border-top: 3px solid #4285f4;
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #4285f4 0%, #ea4335 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.back-home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(66, 133, 244, 0.4);
}

.back-arrow {
    font-size: 20px;
    transition: transform 0.3s;
}

.back-home-btn:hover .back-arrow {
    transform: translateX(-5px);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .info-panel {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .container {
        border-radius: 10px;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 26px;
    }

    .content {
        padding: 30px 20px;
    }

    .templates-grid,
    .tips-grid {
        grid-template-columns: 1fr;
    }

    .writing-tips {
        padding: 25px;
    }
}

/* Адаптив для 420px */
@media (max-width: 420px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    .header {
        padding: 25px 15px;
    }

    .header h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .header p {
        font-size: 14px;
    }

    .content {
        padding: 25px 15px;
    }

    /* Info Panel */
    .info-panel {
        flex-direction: column;
        gap: 15px;
        padding: 20px 15px;
    }

    .info-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .info-icon {
        font-size: 28px;
    }

    .info-content strong {
        font-size: 13px;
    }

    .info-content {
        font-size: 12px;
    }

    /* Main Layout */
    .main-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .form-section h2,
    .preview-section h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

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

    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select {
        padding: 12px;
        font-size: 14px;
    }

    .hint {
        font-size: 12px;
    }

    .generate-btn {
        padding: 15px;
        font-size: 16px;
    }

    /* Preview Section */
    .ad-preview {
        padding: 15px;
    }

    .ad-label {
        font-size: 12px;
    }

    .headline {
        font-size: 18px;
        padding: 8px;
        min-height: 40px;
    }

    .description {
        font-size: 13px;
        padding: 10px;
        min-height: 55px;
    }

    .char-count {
        font-size: 11px;
    }

    /* Results */
    .results {
        padding: 20px 15px;
    }

    .results h3 {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .result-block {
        padding: 15px;
        margin-bottom: 15px;
    }

    .result-block h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .result-item {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .result-text {
        font-size: 14px;
    }

    .copy-btn {
        width: 100%;
        padding: 8px 14px;
        font-size: 12px;
    }

    .tips-section {
        padding: 15px;
    }

    .tips-section h4 {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .tips-section li {
        font-size: 13px;
        padding: 6px 0;
        padding-left: 22px;
    }

    .copy-all-btn {
        padding: 14px;
        font-size: 15px;
    }

    /* Templates Section */
    .templates-section {
        margin-bottom: 40px;
    }

    .templates-section h2 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .templates-desc {
        font-size: 14px;
        margin-bottom: 25px;
    }

    .templates-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .template-card {
        padding: 20px 15px;
    }

    .template-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .template-card h3 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .template-card p {
        font-size: 13px;
        margin-bottom: 15px;
    }

    .use-template-btn {
        padding: 9px 18px;
        font-size: 13px;
    }

    /* Writing Tips */
    .writing-tips {
        padding: 25px 15px;
    }

    .writing-tips h2 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .tips-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tip-card {
        padding: 20px 15px;
    }

    .tip-number {
        width: 35px;
        height: 35px;
        font-size: 18px;
        top: -12px;
        left: 15px;
    }

    .tip-card h3 {
        font-size: 16px;
        margin-bottom: 8px;
        margin-top: 8px;
    }

    .tip-card p {
        font-size: 13px;
    }

    .back-home-container {
        padding: 20px 15px;
    }

    .back-home-btn {
        padding: 12px 20px;
        font-size: 14px;
        gap: 8px;
    }

    .back-arrow {
        font-size: 18px;
    }
}
