/* Toolnexa Custom Styles */

:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

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

*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    background: #ffffff;
    overscroll-behavior-y: none;
    height: 100%;
}

html.dark {
    background: #111827;
}

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    height: 100%;
    background: linear-gradient(to bottom right, #dbeafe, #ffffff, #f3e8ff);
    overscroll-behavior-y: none;
}

body.dark {
    background: #111827;
}

.dark body {
    background: #111827;
}

/* Header Styles */
header {
    position: sticky;
    top: 0;
    z-index: 50;
}

header .container > div:first-child {
    display: flex;
    align-items: center;
    min-height: 40px;
}

/* Logo alignment */
header .flex.items-center.space-x-2 {
    align-items: center;
}

header .flex.items-center.space-x-2 > div:first-child {
    display: flex;
    align-items: center;
    line-height: 1;
}

/* Search Input */
#searchInput {
    height: 40px;
    line-height: 1.5;
    display: block;
}

#searchInput::placeholder {
    color: #9ca3af;
}

.dark #searchInput::placeholder {
    color: #6b7280;
}

/* Search icon positioning */
#searchInput + i {
    pointer-events: none;
}

/* Theme Toggle Button */
#themeToggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

#themeToggle i {
    display: block;
    line-height: 1;
}

/* Category Buttons */
.category-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
    background: white;
    color: #4b5563;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    min-height: 38px;
    line-height: 1.2;
}

.category-btn i {
    font-size: 0.875rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.category-btn span {
    flex-shrink: 0;
}

.dark .category-btn {
    background: #374151;
    color: #d1d5db;
}

.category-btn:hover {
    background: #f3f4f6;
    border-color: var(--primary);
}

.dark .category-btn:hover {
    background: #4b5563;
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.dark .category-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.6);
}

/* Tool Cards */
.tool-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dark .tool-card {
    background: #1f2937;
    border-color: #374151;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.3s;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .tool-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.tool-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #111827;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.dark .tool-card-title {
    color: white;
}

.tool-card-desc {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-grow: 1;
}

.dark .tool-card-desc {
    color: #9ca3af;
}

.tool-card-category {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
}

.dark .tool-card-category {
    background: #374151;
    color: #9ca3af;
}

/* Input/Output Sections */
.input-section,
.output-section {
    margin-bottom: 1.5rem;
    width: 100%;
}

.section-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    word-wrap: break-word;
}

.dark .section-label {
    color: #d1d5db;
}

.input-field,
.output-field {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    color: #111827;
}

.dark .input-field,
.dark .output-field {
    background: #374151;
    border-color: #4b5563;
    color: white;
}

.input-field:focus,
.output-field:focus {
    outline: none;
    border-color: var(--primary);
    ring: 2px;
    ring-color: var(--primary);
}

textarea.input-field,
textarea.output-field {
    min-height: 150px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    white-space: nowrap;
    text-align: center;
    word-wrap: normal;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.dark .btn-secondary {
    background: #374151;
    color: #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.dark .btn-secondary:hover {
    background: #4b5563;
}

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

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

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Copy Button */
.copy-btn {
    position: relative;
}

.copy-btn.copied::after {
    content: '✓ Copied!';
    position: absolute;
    top: -2rem;
    right: 0;
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Tabs */
.tab-container {
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.dark .tab-container {
    border-color: #374151;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.dark .tab-btn {
    color: #9ca3af;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Social Share Buttons */
.social-share-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dark .social-share-btn {
    background: #374151;
    color: #9ca3af;
}

.social-share-btn:hover {
    transform: translateY(-2px);
    color: white;
}

.social-share-btn:hover {
    background: #1da1f2;
}

.social-share-btn:nth-child(2):hover {
    background: #1877f2;
}

.social-share-btn:nth-child(3):hover {
    background: #0a66c2;
}

.social-share-btn:nth-child(4):hover {
    background: #333;
}

/* Footer Mobile Optimization */
@media (max-width: 480px) {
    footer {
        padding: 1rem 0 !important;
    }
    
    footer .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    footer p {
        line-height: 1.5 !important;
    }
    
    .social-share-btn {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 0.875rem !important;
    }
}

/* Keyboard Shortcut Badge */
.kbd {
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-family: monospace;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.dark .kbd {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

/* Range Slider */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.dark input[type="range"] {
    background: #4b5563;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

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

.dark .progress-bar {
    background: #4b5563;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s;
}

/* Alert/Info Box */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info);
    color: #1e40af;
}

.dark .alert-info {
    background: #1e3a8a;
    color: #93c5fd;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.dark .alert-success {
    background: #064e3b;
    color: #6ee7b7;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.dark .alert-warning {
    background: #78350f;
    color: #fcd34d;
}

/* Result Card */
.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
}

.dark .form-label {
    color: #d1d5db;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    color: #111827;
}

.dark .form-input,
.dark .form-select {
    background: #374151;
    border-color: #4b5563;
    color: white;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: #374151;
}

.dark .checkbox-label,
.dark .radio-label {
    color: #d1d5db;
}

/* Tag/Badge */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
}

.dark .tag {
    background: #374151;
    color: #9ca3af;
}

/* Color Preview */
.color-preview {
    width: 100%;
    height: 100px;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    margin-bottom: 1rem;
}

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

/* Code Block */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.dark .code-block {
    background: #0f172a;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */

/* Extra Small Devices (phones, 320px to 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    /* Header adjustments */
    header .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* Header top row */
    header .container > div:first-child {
        min-height: 36px !important;
        gap: 0.5rem !important;
    }
    
    header h1 {
        font-size: 1.125rem !important;
    }
    
    header .text-xs {
        font-size: 0.625rem;
    }
    
    /* Logo emoji */
    header .text-2xl {
        font-size: 1.5rem !important;
    }
    
    /* Search input - fixed height */
    #searchInput {
        height: 36px !important;
        font-size: 0.8125rem !important;
        padding-left: 2rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Search icon */
    #searchInput + i,
    .fa-search {
        left: 0.625rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Theme toggle - fixed size */
    #themeToggle {
        width: 36px !important;
        height: 36px !important;
    }
    
    #themeToggle i {
        font-size: 0.875rem !important;
    }
    
    /* Search bar */
    #searchInput {
        font-size: 0.8125rem !important;
        padding: 0.5rem 0.75rem !important;
        padding-left: 2rem !important;
    }
    
    /* Search icon */
    #searchInput + i,
    .fa-search {
        left: 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Category navigation container */
    #categoryNav {
        margin-top: 0.75rem !important;
        gap: 0.375rem !important;
    }
    
    /* Category buttons - smaller on mobile */
    .category-btn {
        padding: 0.375rem 0.625rem !important;
        font-size: 0.6875rem !important;
        min-height: 30px !important;
        gap: 0.25rem !important;
        border-radius: 0.375rem !important;
    }
    
    .category-btn i {
        font-size: 0.6875rem !important;
        width: 10px !important;
    }
    
    .category-btn span {
        font-size: 0.6875rem !important;
    }
    
    /* Main container */
    main.container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    /* Tool cards */
    .tool-card {
        padding: 1rem !important;
    }
    
    .tool-card-icon {
        font-size: 1.75rem !important;
        margin-bottom: 0.625rem !important;
    }
    
    .tool-card-title {
        font-size: 0.9375rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    .tool-card-desc {
        font-size: 0.8125rem !important;
        line-height: 1.4 !important;
    }
    
    /* Tools grid - 2 columns on mobile */
    #toolsGrid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Buttons */
    .btn {
        width: 100% !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.8125rem !important;
        min-height: 38px !important;
    }
    
    .btn i {
        font-size: 0.875rem !important;
    }
    
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    
    .btn-group .btn {
        margin: 0 !important;
    }
    
    /* Result cards */
    .result-card {
        padding: 1rem !important;
        margin-bottom: 0.875rem !important;
    }
    
    .result-value {
        font-size: 1.375rem !important;
        line-height: 1.3 !important;
    }
    
    .result-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    /* Grid layouts - 2 columns on mobile */
    .grid-2,
    .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Input/Output sections */
    .input-section,
    .output-section {
        margin-bottom: 1rem !important;
    }
    
    .section-label {
        font-size: 0.8125rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .input-field,
    .output-field {
        padding: 0.625rem !important;
        font-size: 0.8125rem !important;
        border-radius: 0.375rem !important;
    }
    
    textarea.input-field,
    textarea.output-field {
        min-height: 120px !important;
        font-size: 0.8125rem !important;
    }
    
    /* Form elements */
    .form-group {
        margin-bottom: 0.875rem !important;
    }
    
    .form-label {
        font-size: 0.8125rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    .form-input,
    .form-select {
        padding: 0.5rem !important;
        font-size: 0.8125rem !important;
        border-radius: 0.375rem !important;
    }
    
    /* Select dropdown */
    select.form-select {
        background-size: 12px !important;
    }
    
    /* Category header */
    #homeView > div:first-child {
        margin-bottom: 2rem !important;
        padding: 0 0.5rem !important;
    }
    
    #categoryIcon {
        font-size: 2.25rem !important;
    }
    
    #categoryTitle {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
        line-height: 1.3 !important;
    }
    
    #categoryDescription {
        font-size: 0.9375rem !important;
        line-height: 1.5 !important;
        padding: 0 1rem !important;
    }
    
    #categoryToolCount {
        margin-top: 0.75rem !important;
        padding: 0.375rem 0.875rem !important;
        font-size: 0.8125rem !important;
    }
    
    /* Tool detail view */
    #toolView {
        padding: 0 !important;
    }
    
    /* Breadcrumb */
    #toolView nav {
        margin-bottom: 1rem !important;
        font-size: 0.75rem !important;
    }
    
    #toolView nav i {
        font-size: 0.625rem !important;
    }
    
    /* Tool detail header */
    #toolView > div:first-child {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    #toolIcon {
        font-size: 2rem !important;
    }
    
    #toolTitle {
        font-size: 1.375rem !important;
        line-height: 1.3 !important;
    }
    
    #toolDescription {
        font-size: 0.8125rem !important;
        line-height: 1.5 !important;
    }
    
    /* Tool content area */
    #toolContent {
        padding: 1rem !important;
    }
    
    /* Back to top button */
    .back-to-top {
        bottom: 1rem !important;
        right: 1rem !important;
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1rem !important;
    }
    
    /* Toast notification */
    #toast {
        bottom: 1rem !important;
        right: 1rem !important;
        left: 1rem !important;
        font-size: 0.8125rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Tabs */
    .tab-container {
        margin-bottom: 1rem !important;
    }
    
    .tab-buttons {
        gap: 0.25rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    
    .tab-buttons::-webkit-scrollbar {
        display: none !important;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8125rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    
    /* Privacy notice */
    .bg-green-50 p {
        font-size: 0.75rem !important;
        padding: 0.25rem 0 !important;
    }
    
    .bg-green-50 i {
        font-size: 0.75rem !important;
        margin-right: 0.25rem !important;
    }
    
    /* Footer */
    footer {
        padding: 1.5rem 0.75rem !important;
    }
    
    footer .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    footer p,
    footer a {
        font-size: 0.75rem !important;
    }
    
    footer .flex {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    /* Social icons */
    .social-share-btn {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Alert boxes */
    .alert {
        padding: 0.75rem !important;
        font-size: 0.8125rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Code blocks */
    .code-block {
        padding: 0.75rem !important;
        font-size: 0.75rem !important;
        overflow-x: auto !important;
    }
    
    /* Tags */
    .tag {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.6875rem !important;
    }
}

/* Small Devices (phones, 481px to 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    /* Container padding */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Header */
    header h1 {
        font-size: 1.25rem !important;
    }
    
    header .text-2xl {
        font-size: 1.75rem !important;
    }
    
    /* Search */
    #searchInput {
        height: 38px !important;
        font-size: 0.875rem !important;
    }
    
    /* Theme toggle */
    #themeToggle {
        width: 38px !important;
        height: 38px !important;
    }
    
    /* Category navigation */
    #categoryNav {
        gap: 0.375rem !important;
    }
    
    /* Category buttons */
    .category-btn {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8125rem !important;
        min-height: 34px !important;
    }
    
    .category-btn i {
        font-size: 0.8125rem !important;
        width: 13px !important;
    }
    
    /* Tool cards */
    .tool-card {
        padding: 1.125rem !important;
    }
    
    .tool-card-icon {
        font-size: 1.875rem !important;
    }
    
    .tool-card-title {
        font-size: 1rem !important;
    }
    
    .tool-card-desc {
        font-size: 0.875rem !important;
    }
    
    /* Buttons */
    .btn-group {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .btn {
        width: 100% !important;
        padding: 0.625rem 1rem !important;
    }
    
    /* Result cards */
    .result-card {
        padding: 1.25rem !important;
    }
    
    .result-value {
        font-size: 1.5rem !important;
    }
    
    .result-label {
        font-size: 0.8125rem !important;
    }
    
    /* Grid layouts - 2 columns on small mobile */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Category header */
    #categoryIcon {
        font-size: 3rem !important;
    }
    
    #categoryTitle {
        font-size: 2rem !important;
    }
    
    #categoryDescription {
        font-size: 1rem !important;
    }
    
    /* Back to top */
    .back-to-top {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
        width: 2.75rem !important;
        height: 2.75rem !important;
        font-size: 1.125rem !important;
    }
}

/* Medium Devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    /* Container padding */
    .container {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    /* Header */
    header h1 {
        font-size: 1.5rem !important;
    }
    
    #searchInput {
        max-width: 280px !important;
        height: 40px !important;
    }
    
    #themeToggle {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Category buttons */
    .category-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Tool cards - 4 columns on tablet */
    #toolsGrid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Grid layouts - 4 columns on tablet */
    .grid-2 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* Result cards */
    .result-value {
        font-size: 1.75rem !important;
    }
    
    /* Category header */
    #categoryTitle {
        font-size: 2.5rem !important;
    }
    
    #categoryDescription {
        font-size: 1.125rem !important;
    }
}

/* Large Devices (desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    /* Container */
    .container {
        max-width: 960px !important;
    }
    
    /* Tool cards - 6 columns on desktop */
    #toolsGrid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Grid layouts - 6 columns on desktop */
    .grid-2 {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    /* Tool cards - 6 columns on large desktop */
    #toolsGrid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 1.25rem !important;
    }
    
    /* Container max width */
    .container {
        max-width: 1280px !important;
    }
    
    /* Grid layouts */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px !important;
    }
    
    #toolsGrid {
        gap: 1.75rem !important;
    }
}

/* Very Small Screens (max 360px) */
@media (max-width: 360px) {
    /* Extra tight spacing for very small screens */
    body {
        font-size: 13px !important;
    }
    
    header .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    header .container > div:first-child {
        gap: 0.375rem !important;
    }
    
    header h1 {
        font-size: 1rem !important;
    }
    
    header .text-2xl {
        font-size: 1.375rem !important;
    }
    
    #searchInput {
        height: 34px !important;
        font-size: 0.75rem !important;
        padding-left: 1.875rem !important;
    }
    
    #searchInput + i {
        left: 0.5rem !important;
        font-size: 0.6875rem !important;
    }
    
    #themeToggle {
        width: 34px !important;
        height: 34px !important;
    }
    
    #themeToggle i {
        font-size: 0.8125rem !important;
    }
    
    .category-btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.625rem !important;
        min-height: 28px !important;
    }
    
    .category-btn i {
        width: 8px !important;
        font-size: 0.625rem !important;
    }
    
    .tool-card {
        padding: 0.75rem !important;
    }
    
    .tool-card-title {
        font-size: 0.875rem !important;
    }
    
    .tool-card-desc {
        font-size: 0.75rem !important;
    }
    
    .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
        min-height: 36px !important;
    }
    
    #categoryTitle {
        font-size: 1.375rem !important;
    }
    
    #categoryDescription {
        font-size: 0.875rem !important;
    }
}

/* Landscape orientation fixes for phones */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        position: relative;
    }
    
    .category-btn {
        padding: 0.375rem 0.75rem;
        min-height: 30px;
    }
    
    #categoryIcon {
        display: none;
    }
    
    #categoryTitle {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #categoryDescription {
        display: none;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .back-to-top,
    #toast,
    .category-btn,
    #searchInput,
    #themeToggle {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .tool-card,
    .result-card {
        break-inside: avoid;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-in;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Theme Toggle Button */
#themeToggle {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#themeToggle:active {
    transform: scale(0.95);
}

#themeToggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

#themeToggle i {
    pointer-events: none;
}

/* Ensure icons switch properly */
.dark #themeToggle .fa-moon {
    display: none !important;
}

.dark #themeToggle .fa-sun {
    display: inline !important;
}

#themeToggle .fa-moon {
    display: inline !important;
}

#themeToggle .fa-sun {
    display: none !important;
}

/* Back to Top Button */
.back-to-top {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    width: 3rem !important;
    height: 3rem !important;
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
    transition: all 0.3s ease !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.8) translateY(20px) !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
}

.back-to-top.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) translateY(0) !important;
    pointer-events: auto !important;
}

.back-to-top:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.6);
}

.back-to-top:active {
    transform: scale(0.95) translateY(-2px);
}

.back-to-top i {
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1rem !important;
    }
}
