/*
================================
1. Root Variables & Global Reset
================================
*/
:root {
    --primary-color: #007bff; /* Main Blue for action buttons and focus */
    --secondary-color: #343a40; /* Dark text and background elements */
    --background-color: #f8f9fa; /* Light background for the whole page */
    --card-background: #ffffff; /* White background for the main tool box */
    --border-color: #ced4da; /* Light border color */
    --success-color: #28a745; /* Green for download links/success */
    --shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--secondary-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
}

/*
================================
2. Header and Main Layout
================================
*/
.site-header {
    text-align: center;
    padding: 40px 20px 20px;
    background-color: var(--card-background);
    border-bottom: 3px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.site-header h1 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin: 0 0 5px 0;
}

.site-header p {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0;
}

.tool-page {
    max-width: 850px;
    margin: 40px auto;
    padding: 30px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/*
================================
3. File Converter UI Elements
================================
*/

.fileconverter-container {
    display: flex;
    flex-wrap: wrap; 
    gap: 25px;
    align-items: flex-start; /* Align items to the top */
    justify-content: space-between;
    padding: 20px 0;
}

.file-label, .label-heading {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

/* Custom File Input (Label) */
.file-label {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
    flex-basis: 100%; /* Default full width for input section */
}

.file-label:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

#fileInput {
    display: none; /* Hide the default browser file input */
}

/* Select Box and Convert Button Group */
#convertType, #convertBtn {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 1rem;
    height: 48px; /* Standardize height */
    box-sizing: border-box;
    margin-top: 5px;
}

#convertType {
    border: 1px solid var(--border-color);
    flex-grow: 1; /* Allow it to take up available space */
    max-width: 350px;
}

/* Convert Button */
#convertBtn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 120px;
}

#convertBtn:hover {
    background-color: #0056b3;
}

/* Conversion Options and Button Wrapper */
.conversion-controls {
    display: flex;
    align-items: flex-end; /* Align elements vertically */
    gap: 15px;
    width: 100%;
    margin-top: 15px;
}

/*
================================
4. Result and Download Section
================================
*/
.result-container {
    margin-top: 30px;
    padding: 30px;
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    min-height: 120px;
    width: 100%;
    text-align: center;
    background-color: #fcfcfc;
}

.result-container p {
    color: #6c757d;
    margin: 0;
    font-style: italic;
}

#downloadLink {
    display: none;
    background-color: var(--success-color);
    color: white;
    padding: 14px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 25px;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
    transition: background-color 0.3s;
}

#downloadLink:hover {
    background-color: #1e7e34;
}

/* Styling for preview images inside result container */
.result-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
}

/*
================================
5. Footer & Back To Top
================================
*/

.site-footer {
    text-align: center;
    padding: 15px;
    background-color: var(--secondary-color);
    color: white;
    margin-top: 50px;
}

#backToTop {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: none; /* Controlled by fetch.js/scroll listener */
    transition: background-color 0.3s;
}

#backToTop:hover {
    background-color: var(--primary-color);
}


/*
================================
6. Responsive Adjustments
================================
*/
@media (max-width: 768px) {
    .tool-page {
        margin: 20px 10px;
        padding: 20px;
    }
    
    .site-header h1 {
        font-size: 2rem;
    }

    /* Stack controls vertically on smaller screens */
    .fileconverter-container {
        gap: 15px;
    }

    #convertType, #convertBtn, .file-label {
        width: 100%;
        max-width: none;
    }
    
    .conversion-controls {
        flex-direction: column;
        align-items: center;
    }

    #convertType {
        width: 100%;
    }

    #convertBtn {
        width: 100%;
    }
}/*
================================
Back to Top Button Styles
================================
*/
#backToTop {
    /* 1. Position: اسکرین پر طے شدہ جگہ */
    position: fixed;
    bottom: 30px; /* نیچے سے 30px اوپر */
    right: 30px; /* دائیں سے 30px اندر */
    
    /* 2. Appearance: شکل و صورت */
    background-color: var(--secondary-color, #343a40); /* گہرا رنگ (جو آپ نے پہلے دیا تھا) */
    color: white; /* سفید ٹیکسٹ */
    border: none;
    border-radius: 50%; /* اسے گول دائرہ بناتا ہے */
    
    /* 3. Size and Typography: سائز اور فونٹ */
    width: 50px;
    height: 50px;
    font-size: 1.5rem; /* بڑا تیر (↑) */
    line-height: 50px; /* ٹیکسٹ کو درمیان میں لانے کے لیے */
    text-align: center;
    padding: 0;
    
    /* 4. Interaction: حرکت اور سایہ */
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s, opacity 0.3s; /* ہموار حرکت کے لیے */
    
    /* 5. Visibility: سکرپٹ کے ذریعے کنٹرول ہو گی */
    z-index: 1000; /* یقینی بناتا ہے کہ یہ دوسرے عناصر کے اوپر رہے */
    display: none; /* ابتدائی طور پر اسے چھپا دیں (آپ کی جاوا سکرپٹ اسے "block" کرے گی) */
}


/* Mobile Adjustments: چھوٹے سکرین کے لیے */
