/* ============================================================
   TOOL PAGES styles (Upload Zone, File List, etc.)
   ============================================================ */

.tool-container {
    padding-top: 120px;
    padding-bottom: 80px;
    min-height: 80vh;
}

.tool-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
    animation: fadeInUp-out;
}

.tool-header {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(204, 0, 0, 0.03) 0%, transparent 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.tool-icon-large {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(204, 0, 0, 0.12);
    border: 1px solid rgba(204, 0, 0, 0.1);
}

.tool-title {
    font-family: var(--font-head);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--clr-text);
    margin-bottom: 0.5rem;
}

.tool-subtitle {
    font-size: 1.1rem;
    color: var(--clr-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Upload Area */
.upload-area {
    padding: 4rem 2rem;
    text-align: center;
}

.drop-zone {
    border: 3px dashed #e0e0e0;
    border-radius: 20px;
    padding: 4rem 2rem;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--nav-bg);
    background: rgba(204, 0, 0, 0.02);
    transform: scale(1.01);
}

.drop-zone-icon {
    font-size: 3rem;
    color: var(--nav-bg);
    margin-bottom: 1.5rem;
    display: block;
}

.drop-zone-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 0.5rem;
}

.drop-zone-hint {
    font-size: 0.9rem;
    color: var(--clr-text-muted);
}

.file-input {
    display: none;
}

/* File Preview List */
.file-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.file-item {
    background: #fff;
    border: 1px solid #eee;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    color: #ff4d4d;
    font-size: 1.2rem;
}

.file-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--clr-text);
}

.file-size {
    font-size: 0.8rem;
    color: var(--clr-text-muted);
}

.remove-file {
    color: #999;
    cursor: pointer;
    transition: color 0.2s
}

.remove-file:hover {
    color: #ff4d4d;
}

/* Action Button */
.action-container {
    margin-top: 3rem;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: translateY(10px);
}

.action-container.visible {
    display: block !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-execute {
    background: var(--nav-bg);
    color: white;
    padding: 16px 48px;
    border-radius: 99px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(204, 0, 0, 0.25);
    transition: all 0.3s ease;
}

.btn-execute:hover {
    background: var(--nav-bg-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(204, 0, 0, 0.35);
}

.btn-execute.success {
    background: #10b981;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.25);
}

.spinner-small {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

#closestgModalBtn {
    position: absolute;
    right: 0;
    top: 0;
}

.btn-ghost {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #64748b;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-ghost:hover {
    background: #f1f5f9;
}

.btn-primary {
    background: #ee3939;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #d43232;
}

.signature-pad {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 1.5rem;
    touch-action: none;
    /* Prevent scrolling on touch devices */
}

.signature-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.signature-tab {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.signature-tab:hover {
    color: #1e293b;
}

.signature-tab.active {
    color: #ee3939;
    border-color: #ee3939;
}

.signature-tab-content {
    display: none;
}

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

.signature-draw-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.signature-draw-controls button {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    color: #475569;
    transition: background 0.2s;
}

.signature-draw-controls button:hover {
    background: #f1f5f9;
}

.signature-text-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-family: 'Dancing Script', cursive;
    /* Example font */
}

.signature-font-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.signature-actions,
.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-title {
        font-size: 1.8rem;
    }

    .tool-subtitle {
        font-size: 0.95rem;
    }

    .drop-zone {
        padding: 3rem 1.5rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .signature-tab {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    /* Full-width tool cards on mobile */
    .tool-container {
        padding-top: 80px;
        padding-bottom: 40px;
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .section-inner {
        padding: 0 5px; /* Minimal padding for mobile */
    }

    .tool-card {
        padding: 10px 0;
        border-radius: 0;
        width: 100%;
        max-width: 100vw;
        box-shadow: none;
        border-left: none;
        border-right: none;
        overflow-x: hidden;
    }

    .upload-area {
        padding: 1.5rem 0.5rem;
    }
}

/* Tool Page Description / SEO Section */
.tool-seo-section {
    padding: 3rem 2.5rem;
    background-color: #fafafa;
    border-top: 1px solid #f0f0f0;
    text-align: left;
}

.tool-seo-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--clr-text, #1e293b);
    margin-bottom: 1.2rem;
    font-family: var(--font-head, inherit);
}

.tool-seo-section p {
    font-size: 1rem;
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 1.2rem;
}

.tool-seo-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1.2rem;
    list-style-type: disc;
}

.tool-seo-section li {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .tool-seo-section {
        padding: 2rem 1.5rem;
    }
}