:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --accent-color: #00a8e8;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-gradient: linear-gradient(135deg, #e0f2ff 0%, #f0f4f8 100%);
    --card-bg: #ffffff;
    --input-bg: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius-lg: 8px;
    --radius-md: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    animation: slideUp 0.5s ease-out;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-main);
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-color);
}

header p {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Layout */
.top-section {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.calculator-card, .results-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.input-wrapper, .select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.input-wrapper:focus-within, .select-wrapper:focus-within {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    color: var(--text-muted);
}

.input-wrapper input, .select-wrapper select {
    width: 100%;
    padding: 10px 10px 10px 0;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-main);
    outline: none;
}

/* Custom Select Arrow */
.select-wrapper select {
    appearance: none;
    cursor: pointer;
}

.select-wrapper .arrow {
    position: absolute;
    right: 12px;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.unit {
    padding-right: 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    width: 100%;
    padding: 12px 20px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.btn-secondary.expanded svg {
    transform: rotate(180deg);
}

/* Results Section */
.results-card {
    border-top: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.results-card h2 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.result-grid {
    display: grid;
    gap: 16px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-item .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.result-item .value.highlight {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* Detail Table */
.detail-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    text-align: left;
}

td {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:hover td {
    background: #f8fafc;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

/* Utilities */
.hidden {
    display: none;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Layout Wrapper */
.layout-wrapper {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.main-content {
    flex: 2;
    min-width: 0;
}

.seo-sidebar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: all 0.3s ease;
}

.seo-sidebar.expanded {
    flex: 1;
    min-width: 300px;
}

.seo-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.seo-content.hidden {
    display: none;
    opacity: 0;
}

.toggle-btn {
    margin-top: 0;
    width: auto;
    align-self: flex-start;
    white-space: nowrap;
}

.info-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    font-weight: 700;
}

.info-card h4 {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.info-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .layout-wrapper {
        flex-direction: column;
    }
    
    .seo-sidebar {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .seo-sidebar {
        display: none;
    }

    .top-section {
        flex-direction: column;
    }
    
    .container {
        max-width: 500px;
    }
}

/* Help Section (Collapsible at bottom) */
.help-section {
    margin-top: 32px;
}

.help-toggle-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.help-toggle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: #f8fafc;
}

.help-toggle-text {
    font-size: 0.95rem;
    font-weight: 600;
}

.help-toggle-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    color: var(--text-muted);
}

.help-toggle-btn:hover .help-toggle-icon {
    color: var(--primary-color);
}

.help-toggle-btn[aria-expanded="true"] .help-toggle-icon {
    transform: rotate(180deg);
}

.help-content {
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
    transform: translateY(-10px);
    visibility: hidden;
}

.help-content.expanded {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    margin-top: 16px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
