* {
    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;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
}

/* Advertisement Styles */
.ad-container {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.ad-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    color: #666;
    font-weight: 600;
}

.ad-vertical {
    min-height: 600px;
    width: 160px;
}

.ad-top, .ad-bottom {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

/* Layout */
.main-content {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 20px;
    margin-bottom: 20px;
}

.sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.content-main {
    min-width: 0;
}

/* Cards */
.search-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

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

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

input[type="text"], 
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
}

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

select {
    cursor: pointer;
    background: white;
}

.api-keys {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #667eea;
    display: none;
}

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

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

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    animation: slideDown 0.3s ease;
}

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

.alert-error {
    background: #fee;
    color: #c33;
    border-left: 4px solid #c33;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border-left: 4px solid #3c3;
}

/* Results */
.results {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
    margin-bottom: 20px;
}

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

.results h2 {
    color: #333;
    font-size: 1.8em;
    margin: 0;
}

.keyword-item {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.keyword-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.keyword-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.keyword-snippet {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.keyword-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
    margin-top: 12px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-item a {
    color: #667eea;
    text-decoration: none;
}

.meta-item a:hover {
    text-decoration: underline;
}

/* History */
.history {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

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

.history h3 {
    color: #333;
    margin: 0;
}

.history-item {
    padding: 15px;
    background: #f8f9fa;
    margin-bottom: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.history-item:hover {
    background: #e9ecef;
    border-left-color: #667eea;
    transform: translateX(3px);
}

.history-item strong {
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.history-item small {
    color: #666;
    font-size: 12px;
}

/* Custom CSS */
#citySelectorContainer {
    margin: 0 0 20px;
}

.keyword-card {
    display: flex;
    gap: 10px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 4px;
    margin: 14px 0;
    border: 1px solid #d9d9d9;
    justify-content: space-between;
    align-items: center;
}

.keyword-metrics {
    display: flex;
    gap: 10px;
}

.metric {border: 1px solid #ccc;padding: 15px;border-radius: 7px;}

span.metric-label {
    font-weight: 500;
    margin-right: 5px;
    font-size: 14px;
}


/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 30px;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .ad-content {
        display: block;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    .api-keys,
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-header,
    .history-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .btn-secondary,
    .btn-small {
        width: 100%;
    }
    
    .ad-vertical {
        min-height: 250px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .search-card,
    .results,
    .history {
        padding: 20px;
    }
    
    .keyword-meta {
        flex-direction: column;
        gap: 8px;
    }
}