/* CSS Variables */
:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary: #0f766e;
    --success: #10b981;
    --danger: #dc2626;
    --warning: #f59e0b;
    --muted: #6b7280;
    --border: #e5e7eb;
    --light-bg: #f9fafb;
    --dark-bg: #1f2937;
    --foreground: #111827;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-icon {
    width: 1.75rem;
    height: 1.75rem;
    color: var(--primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    gap: 0.35rem;
    padding: 0.5rem;
}

.mobile-menu-toggle span {
    width: 1.5rem;
    height: 0.2rem;
    background-color: var(--primary);
    border-radius: 0.1rem;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(0.5rem, 0.5rem);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(0.35rem, -0.35rem);
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.nav-btn:hover {
    background-color: rgba(30, 64, 175, 0.1);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.nav-link {
    border: 1.5px solid var(--primary);
}

.nav-link:hover {
    background-color: var(--primary);
    color: white;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    border: 1.5px solid var(--primary);
}

.dropdown-toggle:hover {
    background-color: var(--primary);
    color: white;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
}

.dropdown:hover .dropdown-menu {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--light-bg);
    color: var(--primary);
    padding-left: 1.25rem;
}

/* Main Content */
main {
    padding: 3rem 0;
    min-height: calc(100vh - 200px);
}

@media (max-width: 768px) {
    main {
        padding: 2rem 0;
    }
}

/* Section Header */
.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.section-header p {
    font-size: 0.95rem;
    color: var(--muted);
}

/* Form Section */
.form-section {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .form-section {
        padding: 1.5rem;
    }
}

/* Form */
.api-form {
    display: grid;
    gap: 1.5rem;
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    font-size: 0.95rem;
}

.required {
    color: var(--danger);
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: white;
    color: var(--foreground);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-group input:invalid {
    border-color: var(--danger);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .form-actions {
        flex-direction: column;
    }
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Product Info Section */
.product-info-section {
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

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

.product-info-section.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fef08a 100%);
    border-color: #fcd34d;
}

.product-info-section.premium {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #93c5fd;
}

.product-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.warning-badge {
    background-color: #f59e0b;
    color: white;
}

.premium-badge {
    background-color: #3b82f6;
    color: white;
}

.product-info p {
    font-weight: 500;
    margin: 0;
}

.product-info-section.warning p {
    color: #92400e;
}

.product-info-section.premium p {
    color: #1e40af;
}

@media (max-width: 768px) {
    .product-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-info p {
        font-size: 0.9rem;
    }
}

/* Response Section */
.response-section {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .response-section {
        padding: 1.5rem;
    }
}

/* Response Container */
.response-container {
    animation: fadeIn 0.3s ease;
}

/* Response Status */
.response-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.response-status.success {
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
    color: #065f46;
}

.response-status.error {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}

.response-status.loading {
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    color: #1e40af;
}

.status-icon {
    font-size: 1.25rem;
}

.status-text {
    font-size: 0.95rem;
}

/* Response Data */
.response-data {
    margin-bottom: 1.5rem;
}

.response-content {
    background-color: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--foreground);
    word-break: break-all;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Response Actions */
.response-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 0.95rem;
}

/* Footer */
footer {
    background-color: var(--dark-bg);
    color: white;
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

footer p {
    font-size: 0.85rem;
    color: #9ca3af;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--foreground);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.hide {
    animation: slideOut 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Scrollbar */
.response-content::-webkit-scrollbar {
    width: 0.5rem;
}

.response-content::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 0.25rem;
}

.response-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 0.25rem;
}

.response-content::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .header-content {
        gap: 1rem;
    }

    .header-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .header-nav.active {
        max-height: 500px;
    }

    .nav-btn {
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        text-align: left;
        width: 100%;
    }

    .nav-link {
        border: none;
    }

    .nav-link:hover {
        background-color: var(--light-bg);
        color: var(--primary);
    }

    .dropdown {
        width: 100%;
    }

    .dropdown-toggle {
        border: none;
        width: 100%;
        text-align: left;
    }

    .dropdown-toggle:hover {
        background-color: var(--light-bg);
        color: var(--primary);
    }

    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        background: var(--light-bg);
        margin-top: 0;
        border-radius: 0;
        max-width: none;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-item {
        padding-left: 2rem;
        border-bottom: 1px solid var(--border);
    }

    .dropdown-item:hover {
        padding-left: 2.25rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .response-content {
        font-size: 0.8rem;
        max-height: 300px;
    }

    footer {
        margin-top: 2rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
