/* Custom CSS for Web Tools Hub */

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
}

/* Theme transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Code highlighting */
.code-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.dark .code-block {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

/* Tool specific styles */
.tool-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-input,
.tool-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tool-input:focus,
.tool-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .tool-input,
.dark .tool-textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .tool-input:focus,
.dark .tool-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tool-button {
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.tool-button:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.tool-button:active {
    transform: translateY(0);
}

.tool-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Result containers */
.result-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.dark .result-container {
    background: #1e293b;
    border-color: #334155;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.dark .progress-bar {
    background: #374151;
}

/* Error and success messages */
.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-weight: 500;
}

.message-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.message-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.dark .message-success {
    background: #064e3b;
    color: #a7f3d0;
    border-color: #059669;
}

.dark .message-error {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #dc2626;
}

.dark .message-info {
    background: #1e3a8a;
    color: #93c5fd;
    border-color: #2563eb;
}

/* Tool grid */
.tool-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem 0.5rem;
    }
    
    .tool-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Copy button */
.copy-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.3s ease;
}

.copy-button:hover {
    background: #059669;
}

.copy-button.copied {
    background: #6b7280;
}

/* Download button */
.download-button {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.3s ease;
}

.download-button:hover {
    background: #7c3aed;
}

/* Color picker custom styles */
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.dark .color-swatch {
    border-color: #4b5563;
}

/* QR Code canvas */
.qr-canvas {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

.dark .qr-canvas {
    border-color: #4b5563;
}

/* Typing test styles */
.typing-text {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.125rem;
    line-height: 1.8;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.dark .typing-text {
    background: #1e293b;
    border-color: #334155;
}

.typing-char {
    position: relative;
}

.typing-char.correct {
    background: #d1fae5;
    color: #065f46;
}

.typing-char.incorrect {
    background: #fee2e2;
    color: #991b1b;
}

.typing-char.current {
    background: #dbeafe;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { background: #dbeafe; }
    51%, 100% { background: transparent; }
}

/* Keyboard test styles */
.keyboard-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    margin: 2px;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.keyboard-key.pressed {
    background: #3b82f6;
    color: white;
    transform: scale(0.95);
}

.dark .keyboard-key {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

/* Gradient preview */
.gradient-preview {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.dark .gradient-preview {
    border-color: #4b5563;
}

/* Box shadow preview */
.shadow-preview {
    width: 200px;
    height: 200px;
    background: #f9fafb;
    border-radius: 8px;
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #4b5563;
}

.dark .shadow-preview {
    background: #374151;
    color: #f9fafb;
}

/* Border radius preview */
.border-radius-preview {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* AdSense safe spacing */
.ad-container {
    margin: 2rem 0;
    padding: 1rem;
    text-align: center;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
}

.dark .ad-container {
    border-color: #4b5563;
    background: #1f2937;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .tool-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .tool-input,
    .tool-textarea {
        border-width: 3px;
    }
    
    .tool-button {
        border: 2px solid #000;
    }
}

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