/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #1f1f1f;
    --bg-tertiary: #252525;
    --text-primary: #e0e0e0;
    --text-secondary: #808080;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    border: 1px solid var(--border-color);
}

.signup-box {
    max-width: 400px;
}

.signup-link {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.signup-link a {
    color: var(--accent);
    text-decoration: none;
}

.signup-link a:hover {
    text-decoration: underline;
}

.help-text {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.help-text a {
    color: var(--accent);
    text-decoration: none;
}

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

.login-title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
    letter-spacing: 2px;
}

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

.login-form label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: var(--accent);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #2a2a2a;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-full {
    width: 100%;
}

/* Dashboard Layout */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 2px;
}

.template-name {
    font-size: 14px;
    color: var(--text-secondary);
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Drop Zone */
.drop-zone {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    margin-bottom: 24px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.drop-zone.loading .drop-zone-content {
    opacity: 0.3;
    pointer-events: none;
}

.drop-zone.loading .drop-zone-loading {
    display: flex;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s;
}

.drop-icon {
    color: var(--text-secondary);
}

.drop-text {
    font-size: 16px;
    font-weight: 500;
}

.drop-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

.drop-zone-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(37, 37, 37, 0.9);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fields */
.fields-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.field-name {
    font-size: 14px;
    font-weight: 500;
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-copy:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-copy.copied {
    color: var(--success);
}

.field-value {
    padding: 16px;
    min-height: 56px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.field-value:hover:not([data-empty="true"]) {
    background: var(--bg-tertiary);
}

.field-value[data-empty="true"] {
    cursor: default;
}

.field-value .placeholder {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

.field-value .value {
    color: var(--text-primary);
    word-break: break-word;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
}

/* API Info Section */
.api-info {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.api-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.api-url-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.api-url-input {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

.btn-copy-url {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-copy-url:hover {
    color: var(--text-primary);
    background: #2a2a2a;
}

.api-actions {
    display: flex;
    justify-content: flex-end;
}

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

/* Footer */
.footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.footer-form {
    display: flex;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 16px;
    min-width: 250px;
    max-width: 350px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
}

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

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

/* Responsive */
@media (max-width: 600px) {
    .header {
        padding: 12px 16px;
    }

    .main-content {
        padding: 16px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .template-name {
        display: none;
    }
}
