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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    color: #2d3748;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section {
    margin-bottom: 40px;
}

.section-title {
    color: #4a5568;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    display: inline-block;
}

.sitelink-title {
    color: #4a5568;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.sitelink-group {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid #e2e8f0;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

input[type="text"], 
input[type="url"], 
textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
}

input[type="text"]:focus, 
input[type="url"]:focus, 
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

input[type="password"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
}

input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.character-counter {
    position: absolute;
    right: 15px;
    bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f8f9fa;
    color: #28a745;
    transition: all 0.3s ease;
}

.character-counter.warning {
    color: #ffc107;
    background: #fff3cd;
}

.character-counter.danger {
    color: #dc3545;
    background: #f8d7da;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.expand-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px auto;
}

.expand-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.expand-button:active {
    transform: translateY(0);
}

.expanded-fields {
    display: none;
    animation: slideDown 0.3s ease;
}

.expanded-fields.show {
    display: block;
}

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

.plus-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

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

.preview-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    border: 2px solid #e2e8f0;
}

.ad-preview {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.preview-url {
    color: #5f6368;
    font-size: 14px;
    margin-bottom: 8px;
}

.preview-domain {
    color: #202124;
    font-weight: 500;
}

.preview-headlines {
    color: #1a0dab;
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.3;
}

.preview-headline-placeholder,
.preview-description-placeholder {
    color: #999;
    font-style: italic;
}

.preview-descriptions {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.5;
}

.preview-sitelinks {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.preview-sitelink {
    flex: 0 0 calc(50% - 8px);
}

.preview-sitelink-headline {
    color: #1a0dab;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.preview-sitelink-description {
    color: #4d5156;
    font-size: 12px;
    line-height: 1.4;
}

.preview-sitelink-url {
    color: #006621;
    font-size: 12px;
    margin-top: 2px;
}

.export-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.export-button {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

.export-button:active {
    transform: translateY(0);
}

.export-icon {
    font-size: 20px;
}

/* AI Generation Styles */
.ai-section {
    background: linear-gradient(135deg, #f6f8ff 0%, #f0f4ff 100%);
    border: 2px solid #667eea;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    animation: slideDown 0.3s ease;
}

.ai-toggle-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ai-toggle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ai-toggle-button:active {
    transform: translateY(0);
}

.ai-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.generate-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.settings-button {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 15px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.settings-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.sparkle-icon {
    font-size: 20px;
}

.status-message {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.loading {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    color: #2d3748;
    margin-bottom: 15px;
}

.modal-description {
    color: #718096;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.save-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 15px;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.help-text {
    color: #718096;
    font-size: 12px;
    margin-top: 15px;
    text-align: center;
}

.help-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.help-text a:hover {
    text-decoration: underline;
}

.pdf-upload-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    background: #f8f9ff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.pdf-upload-input:hover {
    border-color: #764ba2;
    background: #f0f4ff;
}

.pdf-status {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: none;
}

.pdf-status.show {
    display: block;
}

.pdf-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pdf-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.manual-input-section {
    margin-top: 15px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

.manual-input-toggle {
    cursor: pointer;
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    padding: 8px 0;
}

.manual-input-toggle:hover {
    color: #764ba2;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .ai-button-group {
        flex-direction: column;
    }
    
    .generate-button,
    .settings-button {
        width: 100%;
    }
    
    .preview-sitelink {
        flex: 0 0 100%;
    }
}
