/* --- CSS Variables for Theming --- */
:root {
    --bg-color: #1E1E2F;
    --text-color: #EAEAEA;
    --header-bg: #2B2D42;
    --accent-color: #FFD700;
    --card-bg: #3A3D5B;
    --button-hover-color: #E6C200;
    --shadow-color: rgba(255, 215, 0, 0.2);
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* --- General & Reset Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- Header --- */
header {
    background-color: var(--header-bg);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--accent-color);
}

header h1 {
    color: var(--accent-color);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

/* --- Main Content & Tool Grid --- */
main {
    padding: 2rem 1rem;
}

.tool-grid {
    display: grid;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    grid-template-columns: repeat(3, 1fr);
}

/* --- Tool Card --- */
.tool-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid transparent;
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-10px);
    background-color: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.tool-card h2 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.tool-card:hover h2 {
    color: var(--bg-color);
}

.tool-card p {
    flex-grow: 1;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.tool-card button {
    align-self: flex-start;
}

/* --- Buttons --- */
button, .button-style {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    border-radius: 5px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover, .button-style:hover {
    background-color: var(--button-hover-color);
    transform: scale(1.05);
}

/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--header-bg);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    animation: slideIn 0.4s ease-out;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-bg);
}

#modal-title {
    color: var(--accent-color);
}

.close-button {
    color: var(--text-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: var(--accent-color);
}

.modal-body {
    padding-top: 1rem;
    overflow-y: auto;
}

/* --- Tool-Specific UI Elements --- */
.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="color"],
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 5px;
    border: 1px solid var(--card-bg);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.modal-body textarea {
    min-height: 150px;
    resize: vertical;
}

.modal-body input[type="file"] {
    color: var(--text-color);
}
.modal-body input[type="checkbox"]{
    margin-right: 0.5rem;
}
.modal-body .option-group{
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: 5px;
    border: 1px solid var(--card-bg);
}

.result-box h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.status-message {
    margin-top: 1rem;
    font-style: italic;
    color: var(--accent-color);
}

#image-cropper-container {
    position: relative;
    max-width: 100%;
    margin: 1rem 0;
}
#cropper-canvas {
    max-width: 100%;
    display: block;
}

#qr-code-container canvas {
    background: white;
    padding: 10px;
    border-radius: 5px;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 1.8rem;
    }
    .modal-content {
        width: 95%;
        padding: 15px;
    }
}