/* --- GLOBAL & RESET --- */
html {
    overflow-x: hidden;
    /* Prevent horizontal scroll on root */
    width: 100%;
}

body {
    overflow-x: hidden;
    /* Double protection for mobile */
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- GLASSMORPHISM --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.dark .glass-panel {
    background: rgba(26, 26, 46, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- CARD COMPONENT STYLES --- */
.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    /* gap-3 */
    cursor: pointer;
    text-decoration: none;
    position: relative;
    /* Ensure card area is clickable and stable */
    width: 100%;
}

/* Glass Icon Card Style */
.glass-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    /* Dimensions - Squircle Fixed Size */
    width: 72px;
    height: 72px;

    /* Effects */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

    /* iOS Squircle Shape - Explicitly Defined */
    border-radius: 22%;

    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 640px) {
    .glass-icon {
        width: 84px;
        height: 84px;
    }
}

.dark .glass-icon {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hover Effects */
.tool-card:hover .glass-icon {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Text Styles */
.tool-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.tool-title {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    /* slate-700 */
    line-height: 1.25;
    margin-bottom: 2px;
    transition: color 0.2s ease;
}

.dark .tool-title {
    color: #cbd5e1;
    /* slate-300 */
}

.tool-desc {
    font-size: 11px;
    color: #94a3b8;
    /* slate-400 */
    line-height: 1.3;
    max-width: 110px;

    /* Clamp text to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .tool-desc {
    color: #64748b;
    /* slate-500 */
}

.tool-card:hover .tool-title {
    color: #667eea;
    /* primary color */
}

/* --- AD LAYOUT PROTECTION --- */
/* Enforce minimum dimensions to prevent Layout Shift (CLS) */
/* No visible borders or backgrounds - strictly sizing */
.ad-sidebar-container {
    min-width: 160px;
    min-height: 600px;
}

.ad-banner-container {
    min-width: 280px;
    min-height: 90px;
}

/* --- ICONS --- */
/* Material Symbols configuration */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 36px !important;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .material-symbols-outlined {
        font-size: 40px !important;
    }
}

/* --- GRID LAYOUT --- */
.tools-grid {
    display: grid;
    /* Mobile: 3 columns */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem 0.75rem;
    width: 100%;
}

@media (min-width: 640px) {
    .tools-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 2rem 1.5rem;
    }
}

@media (min-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* --- COLOR UTILITIES --- */
/* Explicit background colors */
.bg-red-500 {
    background-color: #ef4444 !important;
}

.bg-orange-500 {
    background-color: #f97316 !important;
}

.bg-amber-500 {
    background-color: #f59e0b !important;
}

.bg-yellow-500 {
    background-color: #eab308 !important;
}

.bg-lime-500 {
    background-color: #84cc16 !important;
}

.bg-green-500 {
    background-color: #22c55e !important;
}

.bg-emerald-500 {
    background-color: #10b981 !important;
}

.bg-teal-500 {
    background-color: #14b8a6 !important;
}

.bg-cyan-500 {
    background-color: #06b6d4 !important;
}

.bg-sky-500 {
    background-color: #0ea5e9 !important;
}

.bg-blue-500 {
    background-color: #3b82f6 !important;
}

.bg-indigo-500 {
    background-color: #6366f1 !important;
}

.bg-violet-500 {
    background-color: #8b5cf6 !important;
}

.bg-purple-500 {
    background-color: #a855f7 !important;
}

.bg-fuchsia-500 {
    background-color: #d946ef !important;
}

.bg-pink-500 {
    background-color: #ec4899 !important;
}

.bg-rose-500 {
    background-color: #f43f5e !important;
}

.bg-red-400 {
    background-color: #f87171 !important;
}

.bg-orange-400 {
    background-color: #fb923c !important;
}

.bg-amber-400 {
    background-color: #fbbf24 !important;
}

.bg-yellow-400 {
    background-color: #facc15 !important;
}

/* White background on hover for all colored icons */
.tool-card:hover .glass-icon {
    background-color: #ffffff !important;
}

/* Dark mode hover Override */
.dark .tool-card:hover .glass-icon {
    background-color: #334155 !important;
    /* slate-700 */
}