/* =========================================
   NEXBLUE FREE TOOLS SYSTEM
   ========================================= */

/* --- Modal Overlay --- */
/* --- GLOBAL UI UPGRADES (PHASE 3) --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.6);
    --neon-accent: #00f2ff;
    --primary-nex: #00AEEF;
    --deep-space: #0f172a;
    --accent-cyan: #00f2ff;
}

body {
    font-family: 'Outfit', sans-serif;
}

/* --- MODERN INPUTS --- */
.input-group-nex {
    position: relative;
    margin-bottom: 24px;
}

.form-control-nex {
    width: 100%;
    padding: 16px 20px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    color: var(--deep-space);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-control-nex:focus {
    background: #fff;
    border-color: var(--primary-nex);
    outline: none;
    box-shadow: 0 4px 20px rgba(0, 174, 239, 0.15);
}

.form-control-nex::placeholder {
    color: #94a3b8;
}

/* --- NEUMORPHIC / GLASS BUTTONS --- */
.btn-nex {
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    font-size: 0.95rem;
}

.btn-primary-nex {
    background: linear-gradient(135deg, var(--primary-nex), var(--accent-cyan));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 174, 239, 0.3);
}

.btn-primary-nex:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 174, 239, 0.4);
}

.btn-primary-nex:active {
    transform: translateY(0);
}

.btn-ghost {
    background: rgba(0, 174, 239, 0.08);
    color: var(--primary-nex);
}

.btn-ghost:hover {
    background: rgba(0, 174, 239, 0.15);
    color: var(--deep-space);
}

/* Tooltip base */
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--deep-space);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 1;
    pointer-events: none;
}

/* --- Modal Overlay --- */
.tool-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    /* Darker premium overlay */
    backdrop-filter: blur(16px);
    /* Heavy blur for glass effect */
    -webkit-backdrop-filter: blur(16px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.tool-modal-content {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    max-width: 900px;
    /* Wider for better utility view */
    border-radius: var(--radius-lg);
    box-shadow: 0 40px 80px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
    animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Custom Scrollbar */
.tool-modal-body::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: 8px;
}

.tool-modal-body::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: #f8fafc;
}

.tool-modal-body::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tool-modal-body::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.tool-modal-header {
    padding: 20px 30px;
    background: linear-gradient(to right, #f8fafc, #fff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--deep-space);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-modal-header h3 i {
    color: var(--primary-nex);
}

/* --- COLOR PALETTE (SWATCH BOOK) --- */
.color-palette-container {
    height: 350px !important;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    display: flex;
}

.color-strip {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 40px;
    cursor: pointer;
    transition: flex 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}

.color-strip:hover {
    flex: 3 !important;
}

.color-code-pill {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.color-strip:hover .color-code-pill {
    transform: translateY(0);
    opacity: 1;
}

/* --- GRADIENT GENERATOR (IMMERSIVE) --- */
.gradient-immersive {
    height: 250px;
    border-radius: 20px;
    margin-bottom: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.gradient-overlay-text {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    padding: 15px 30px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    letter-spacing: 1px;
}

.gradient-controls-floating {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 991px) {
    .tool-modal-content {
        max-width: 95%;
        height: 90vh;
    }

    .invoice-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 20px;
    }

    .invoice-preview-pane {
        height: 500px;
    }
}

@media (max-width: 768px) {
    .tool-modal-header {
        padding: 15px 20px;
    }

    .tool-modal-header h3 {
        font-size: 1.1rem;
    }

    .tool-modal-body {
        padding: 20px;
    }

    .humanizer-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .humanizer-box {
        margin-bottom: 20px;
    }

    .humanizer-textarea {
        min-height: 150px;
    }

    .img-compare-grid {
        grid-template-columns: 1fr;
    }

    .color-palette-container {
        flex-direction: column;
        height: auto !important;
    }

    .color-palette-container>div {
        width: 100%;
        height: 80px;
        padding-bottom: 0 !important;
        align-items: center !important;
    }

    .line-item-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }

    .line-item-row input:first-child {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .tool-modal-overlay {
        padding: 10px;
        align-items: flex-end;
        /* Bottom sheet feel */
    }

    .tool-modal-content {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }

    .pg-controls .toggle-grid {
        grid-template-columns: 1fr;
    }

    .humanizer-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .btn-nex {
        width: 100%;
        justify-content: center;
    }
}

.close-tool {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-tool:hover {
    background: var(--accent-red);
    color: white;
    transform: rotate(90deg);
}

.tool-modal-body {
    padding: 30px;
    overflow-y: auto;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* --- PASSWORD GENERATOR (CYBERPUNK THEME) --- */
.pg-display {
    background: #0f172a;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pg-input-wrap {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.pg-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #00f2ff;
    /* Neon Cyan */
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

.pg-input:focus {
    outline: none;
}

.pg-strength-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.pg-strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px currentColor;
    /* Glow based on color */
}

/* Strength Colors with Glow */
.strength-1 {
    background-color: #ef4444;
    color: #ef4444;
    width: 25%;
}

.strength-2 {
    background-color: #f59e0b;
    color: #f59e0b;
    width: 50%;
}

.strength-3 {
    background-color: #00f2ff;
    color: #00f2ff;
    width: 75%;
}

/* Cyan for strong */
.strength-4 {
    background-color: #10b981;
    color: #10b981;
    width: 100%;
}

.pg-controls {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.control-group label {
    font-weight: 700;
    color: var(--deep-space);
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-nex);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(0, 174, 239, 0.2);
    transition: 0.2s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(0, 174, 239, 0.3);
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--text-muted);
}

.toggle-item:hover {
    background: #fff;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.toggle-item input:checked+span {
    color: var(--deep-space);
}

.toggle-item input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-nex);
}

.btn-tool-action {
    background: var(--light-blue-bg);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: 0.2s;
    cursor: pointer;
    color: var(--primary-nex);
    background: rgba(0, 174, 239, 0.1);
}

.btn-tool-action:hover {
    background: var(--primary-nex);
    color: #fff;
}

/* --- TOOL CARDS --- */
.tool-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 174, 239, 0.3);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--primary-nex));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-icon {
    width: 70px;
    height: 70px;
    background: rgba(0, 174, 239, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--primary-nex);
    font-size: 1.8rem;
    transition: 0.4s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-nex);
    color: #fff;
    box-shadow: 0 10px 20px rgba(0, 174, 239, 0.3);
}

.tool-card h5 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--deep-space);
}

.tool-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
    flex-grow: 1;
}

.btn-tool {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-nex);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-tool:hover {
    color: var(--accent-cyan);
    gap: 10px;
}

/* --- QR CODE GENERATOR (SPLIT CARD) --- */
.qr-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

@media (max-width: 768px) {
    .qr-split-layout {
        grid-template-columns: 1fr;
    }
}

.qr-input-panel {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.qr-preview-panel {
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
    padding: 40px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 350px;
}

.qr-preview-panel::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: var(--primary-nex);
    opacity: 0.05;
    border-radius: 50%;
}

.qr-preview-panel::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 100px;
    height: 100px;
    background: var(--accent-cyan);
    opacity: 0.05;
    border-radius: 50%;
}

#qrcode img {
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    background: #fff;
    padding: 15px;
}

/* --- AI HUMANIZER & SPLIT LAYOUTS --- */
.humanizer-layout,
.invoice-split-layout,
.image-compressor-layout,
.case-converter-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: 100%;
    min-height: 500px;
}

@media (max-width: 768px) {

    .humanizer-layout,
    .invoice-split-layout,
    .image-compressor-layout,
    .case-converter-layout {
        grid-template-columns: 1fr !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column;
        gap: 20px;
    }

    .invoice-preview-pane,
    .humanizer-box,
    .image-preview-box {
        width: 100%;
        min-height: 400px;
    }
}

.humanizer-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.humanizer-textarea {
    flex-grow: 1;
    width: 100%;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    resize: none;
    transition: 0.3s;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02);
}

.humanizer-textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary-nex);
    box-shadow: 0 4px 15px rgba(0, 174, 239, 0.1);
}

.humanizer-btn-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
}

/* --- INVOICE GENERATOR --- */
.invoice-grid {
    display: grid;
    gap: 20px;
}

.invoice-preview {
    background: #fff;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    font-family: 'Times New Roman', serif;
    min-height: 400px;
    border: 1px solid #e2e8f0;
}

/* --- IMAGE COMPRESSOR --- */
.dropzone-nex {
    border: 3px dashed #cbd5e1;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    transition: 0.3s;
    cursor: pointer;
    margin-bottom: 24px;
}

.dropzone-nex:hover,
.dropzone-nex.dragover {
    border-color: var(--primary-nex);
    background: rgba(0, 174, 239, 0.05);
}

.quality-slider-container {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

/* --- WORD COUNTER (DASHBOARD METRICS) --- */
.wc-dashboard {
    background: #f8fafc;
    border-radius: 20px;
    padding: 30px;
}

.wc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-top: 5px;
}

.wc-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease;
}

.wc-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.wc-card h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--primary-nex), var(--deep-space));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.wc-card small {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    color: #94a3b8;
}

.wc-time-pill {
    background: #fff;
    padding: 5px 23px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--deep-space);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.wc-time-pill i {
    color: var(--primary-nex);
}