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

:root {
    --bg-primary: #0B0F14;
    --bg-surface: #111827;
    --border: #1F2937;
    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --cta: #3B82F6;
    --hover: #60A5FA;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--bg-surface);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid var(--border);
}

header {
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 40px 30px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

main {
    padding: 40px 30px;
}

.url-form-container {
    margin-bottom: 40px;
}

.url-form {
    margin-bottom: 20px;
}

.recaptcha-container {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 10px;
}

.recaptcha-container[style*="display: none"] {
    display: none !important;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#longUrl {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s ease;
    outline: none;
}

#longUrl:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#submitBtn {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
}

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

#submitBtn:active {
    transform: translateY(0);
}

#submitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-container {
    animation: slideDown 0.3s ease;
}

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

.result-box {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #e0e0e0;
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.result-url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.result-url {
    flex: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-family: 'Courier New', monospace;
}

.copy-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

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

.copy-btn.copied {
    background: #28a745;
}

.result-info {
    margin-top: 10px;
}

.original-url {
    font-size: 0.85rem;
    color: #666;
    word-break: break-all;
}

.error-container {
    animation: slideDown 0.3s ease;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid var(--danger);
    font-size: 0.95rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature-card {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #333;
}

.feature-card p {
    font-size: 0.9rem;
    color: #666;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* Auth pages */
.auth-container {
    max-width: 500px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input {
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.form-group input:focus {
    border-color: var(--cta);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-primary {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--cta);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

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

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--cta);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--hover);
    text-decoration: underline;
}

/* Header navigation */
.header-nav {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 20px;
}

.auth-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link-primary {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.nav-link-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
}

.nav-link-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Dashboard */
.dashboard-container {
    max-width: 1000px;
}

.dashboard-section {
    margin-bottom: 40px;
}

.dashboard-section h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #333;
}

.section-description {
    color: #666;
    margin-bottom: 20px;
}

.api-key-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.form-input {
    flex: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
}

.form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.new-key-container {
    margin-bottom: 30px;
    animation: slideDown 0.3s ease;
}

.new-key-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
}

.new-key-label {
    font-weight: 600;
    color: #856404;
    margin-bottom: 15px;
}

.api-key-display {
    display: flex;
    gap: 10px;
}

.api-key-input {
    flex: 1;
    padding: 12px 15px;
    font-size: 0.9rem;
    border: 2px solid #ffc107;
    border-radius: 8px;
    background: white;
    color: #333;
    font-family: 'Courier New', monospace;
}

.api-keys-list {
    margin-top: 20px;
}

.api-key-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
}

.api-key-info h4 {
    margin-bottom: 8px;
    color: #333;
}

.api-key-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #667eea;
    margin-bottom: 5px;
    word-break: break-all;
}

.api-key-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.api-key-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-copy {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-copy.copied {
    background: #28a745;
}

.btn-danger {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: #dc3545;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.no-keys, .loading-text {
    text-align: center;
    color: #666;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
}

/* API Documentation */
.api-docs .api-desc {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.api-docs .policy-rules-list {
    margin: 15px 0;
    padding-left: 25px;
    color: #666;
    line-height: 1.8;
}

.api-docs .policy-rules-list li {
    margin-bottom: 8px;
}

.api-docs .policy-rules-list code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #667eea;
}

.api-docs {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
}

.api-docs h3 {
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.api-docs h3:first-child {
    margin-top: 0;
}

.api-docs h4 {
    font-size: 1rem;
    margin-top: 15px;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.code-block pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block code {
    font-family: 'Courier New', monospace;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
    }

    #submitBtn {
        width: 100%;
    }

    .result-url-container {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }

    .features {
        grid-template-columns: 1fr;
    }
    
    .api-key-form {
        flex-direction: column;
    }
    
    .api-key-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .btn-danger {
        width: 100%;
    }
    
    .api-key-display {
        flex-direction: column;
    }
    
    .header-nav {
        flex-direction: column;
        align-items: flex-end;
    }
}

