/* public/css/style.css (FINAL UI/UX REFINEMENT - NO ADS) */

/* Basic Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Global Body & Font */
body {
    font-family: 'Inter', sans-serif; /* Keep Inter */
    line-height: 1.6;
    background-color: #f0f2f5; /* Very light gray for background */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Full viewport height */
    -webkit-font-smoothing: antialiased; /* Smoother text rendering */
    -moz-osx-font-smoothing: grayscale;
}

/* Global Container for Content */
.container {
    max-width: 1100px; /* Slightly wider container */
    margin: 30px auto; /* More vertical spacing */
    padding: 30px;
    background-color: #ffffff;
    border-radius: 16px; /* More rounded corners */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); /* Softer, more pronounced shadow */
    flex-grow: 1;
    display: flex; /* Use flex for layout */
    flex-direction: column; /* Always column, no sidebar layout */
    gap: 30px; /* Gap between sections */
}

/* Header & Navigation */
header {
    background-color: #2c3e50; /* Dark blue-gray */
    color: #ffffff;
    padding: 20px 0; /* More padding */
    text-align: center;
    border-bottom-left-radius: 16px; /* Match container rounding */
    border-bottom-right-radius: 16px;
    margin-bottom: 30px; /* More space below header */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 15px; /* More space */
    font-size: 2.5em; /* Slightly larger */
    font-weight: 700; /* Bolder */
    letter-spacing: -0.5px;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 30px; /* More space between nav items */
}

nav ul li a {
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px; /* More padding */
    border-radius: 10px; /* More rounded */
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: 600;
    opacity: 0.9;
}

nav ul li a:hover {
    background-color: #34495e; /* Slightly lighter hover */
    transform: translateY(-3px); /* Subtle lift effect */
    opacity: 1;
}

/* Main Content Area (inside .container, for general pages) */
.main-content-area {
    flex-grow: 1;
    padding: 0; /* No extra padding here, container already has it */
    width: 100%; /* Ensure it takes full width */
}

/* Forms */
.form-container {
    padding: 35px; /* More padding */
    background-color: #f9fbfd; /* Very light blue-gray */
    border-radius: 14px; /* More rounded */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Softer inner shadow */
    max-width: 550px; /* Slightly wider */
    margin: 30px auto; /* More vertical space */
}

.form-container h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px; /* More space */
    font-size: 2em; /* Larger */
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px; /* More space */
}

.form-group label {
    display: block;
    margin-bottom: 10px; /* More space */
    font-weight: 600; /* Bolder */
    color: #555;
    font-size: 1.05em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px; /* More padding */
    border: 1px solid #e0e6eb; /* Lighter border */
    border-radius: 10px; /* More rounded */
    font-size: 1.05em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #ffffff;
    color: #333;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.25); /* More prominent focus ring */
    outline: none;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 15px 25px; /* More padding */
    background-color: #3498db; /* Primary blue */
    color: white;
    border: none;
    border-radius: 10px; /* More rounded */
    font-size: 1.15em; /* Slightly larger */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3); /* Subtle shadow */
}

.btn:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: translateY(-3px); /* Lift effect */
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4); /* More prominent shadow on hover */
}

.btn-secondary {
    background-color: #95a5a6; /* Gray */
    box-shadow: 0 4px 10px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    box-shadow: 0 6px 15px rgba(149, 165, 166, 0.4);
}

/* Messages (Success/Error/Info) */
.message {
    padding: 15px; /* More padding */
    margin-bottom: 25px; /* More space */
    border-radius: 10px; /* More rounded */
    font-weight: 600;
    text-align: center;
    font-size: 1.05em;
    line-height: 1.5;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Links within forms */
.form-container p {
    text-align: center;
    margin-top: 25px; /* More space */
    font-size: 1em;
    color: #666;
}

.form-container p a {
    color: #3498db;
    text-decoration: none;
    font-weight: 700; /* Bolder */
}

.form-container p a:hover {
    text-decoration: underline;
    color: #2980b9;
}

/* Google Sign-In Button Styling */
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px; /* More padding */
    border: 1px solid #e0e6eb; /* Lighter border */
    border-radius: 10px; /* More rounded */
    background-color: #ffffff;
    color: #555;
    font-size: 1.05em;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.google-signin-btn img {
    margin-right: 12px; /* More space */
    width: 26px; /* Slightly larger icon */
    height: 26px;
}

.google-signin-btn:hover {
    background-color: #f5f8fa; /* Very light hover */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* More prominent shadow on hover */
}

/* Prompt Card Styles (My Prompts & History) */
.prompts-list, .history-list {
    margin-top: 25px; /* More space */
}
.prompt-card, .history-card {
    background-color: #f9fbfd; /* Light background */
    border: 1px solid #e0e6eb; /* Subtle border */
    border-radius: 14px; /* More rounded */
    padding: 25px; /* More padding */
    margin-bottom: 25px; /* More space */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.prompt-card:hover, .history-card:hover {
    transform: translateY(-5px); /* Subtle lift on hover */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.prompt-card h3, .history-card h3 {
    color: #2c3e50;
    margin-bottom: 12px; /* More space */
    font-size: 1.5em; /* Slightly larger */
    border-bottom: 1px solid #e0e6eb; /* Lighter border */
    padding-bottom: 12px;
    font-weight: 700;
}
.prompt-card p, .history-card p {
    margin-bottom: 15px; /* More space */
    line-height: 1.8; /* More readable line height */
    font-size: 1.05em;
    color: #444;
}
.prompt-card .meta-info, .history-card .meta-info {
    font-size: 0.95em; /* Slightly larger */
    color: #666;
    margin-top: 20px; /* More space */
    padding-top: 15px;
    border-top: 1px dashed #e0e6eb; /* Lighter dashed border */
}
.prompt-card .meta-info span, .history-card .meta-info span {
    margin-right: 20px; /* More space */
}
.prompt-card .actions, .history-card .actions {
    margin-top: 20px;
    text-align: right;
}
.prompt-card .actions button, .history-card .actions button {
    padding: 10px 18px; /* More padding */
    font-size: 0.95em;
    border-radius: 8px; /* More rounded */
    margin-left: 12px; /* More space */
    box-shadow: none; /* Remove individual button shadows, rely on card shadow */
}
.prompt-card .actions button:hover, .history-card .actions button:hover {
    transform: translateY(-2px); /* Subtle lift */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Small hover shadow */
}
.prompt-card .actions .edit-btn {
    background-color: #f39c12; /* Orange */
}
.prompt-card .actions .edit-btn:hover {
    background-color: #e67e22;
}
.prompt-card .actions .delete-btn {
    background-color: #e74c3c;
}
.prompt-card .actions .delete-btn:hover {
    background-color: #c0392b;
}

/* Filter Controls (Search/Filter Bar) */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* More gap */
    margin-bottom: 30px; /* More space */
    padding: 20px; /* More padding */
    background-color: #f9fbfd;
    border-radius: 14px;
    border: 1px solid #e0e6eb;
    align-items: flex-end; /* Align items to bottom for consistent input heights */
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.filter-controls .form-group {
    margin-bottom: 0;
    flex-grow: 1;
    min-width: 220px; /* Ensure inputs have enough space */
}
.filter-controls label {
    font-size: 1em;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}
.filter-controls input[type="text"],
.filter-controls select {
    padding: 12px; /* More padding */
    border-radius: 10px; /* More rounded */
    font-size: 1em;
}
.filter-controls button {
    padding: 12px 22px; /* Adjust button padding to fit */
    font-size: 1.05em;
    min-width: 150px; /* Ensure button has decent width */
}

/* Modals (General) */
.modal {
    background-color: rgba(0,0,0,0.7); /* Darker overlay */
}
.modal-content {
    border-radius: 18px; /* Even more rounded */
    box-shadow: 0 12px 40px rgba(0,0,0,0.3); /* Stronger shadow */
    /* REMOVED: margin: auto; */
}
.close-button {
    color: #777;
    transition: color 0.2s ease;
}
.close-button:hover, .close-button:focus {
    color: #333;
}
.modal-content h2 {
    font-size: 2.2em; /* Larger modal title */
    margin-bottom: 25px;
}
.modal-content .btn-group .btn {
    padding: 12px 25px;
    font-size: 1.05em;
}

/* Toast Notification Styles */
#toast-container {
    position: fixed; /* Ensure it's fixed */
    top: 25px; /* Slightly lower */
    right: 25px; /* Slightly more inward */
    z-index: 1050; /* Above modals */
}
.toast {
    padding: 15px 25px; /* More padding */
    border-radius: 10px; /* More rounded */
    box-shadow: 0 6px 20px rgba(0,0,0,0.15); /* Softer shadow */
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: translateY(-20px);
    min-width: 250px;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success {
    background-color: #2ecc71; /* Brighter green */
    color: white;
}
.toast.error {
    background-color: #e74c3c; /* Brighter red */
    color: white;
}
.toast.info {
    background-color: #3498db; /* Primary blue */
    color: white;
}

/* Generate Prompt Page Specific Layout */
.prompt-generator-container {
    padding: 35px;
    background-color: #f9fbfd;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    max-width: 900px; /* Wider for better layout */
    margin: 30px auto;
}
.discipline-selection {
    display: grid; /* Use grid for better control */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive grid */
    gap: 15px;
    margin-bottom: 30px;
}
.discipline-selection label {
    background-color: #ecf0f1;
    padding: 15px 25px; /* More padding */
    border-radius: 12px; /* More rounded */
    font-weight: 700; /* Bolder */
    font-size: 1.1em;
    text-align: center; /* Center text */
    justify-content: center; /* Center content in flexbox */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.discipline-selection input[type="radio"]:checked + label {
    background-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4); /* Stronger shadow for selected */
}
.modifiers-section {
    padding: 25px; /* More padding */
    background-color: #f0f3f5;
    border-radius: 12px;
    border: 1px solid #e0e6eb;
    margin-top: 30px;
}
.modifier-group label {
    font-size: 1.15em; /* Slightly larger */
    margin-bottom: 12px;
}
.modifier-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* More space between options */
}
.modifier-options input[type="checkbox"] + label {
    padding: 10px 20px; /* More padding */
    border-radius: 25px; /* More pill-shaped */
    font-size: 0.95em;
    font-weight: 500;
}
.modifier-options input[type="checkbox"]:checked + label {
    background-color: #2ecc71;
}

#generated-prompt-output {
    padding: 25px; /* More padding */
    border-radius: 14px;
    margin-top: 35px; /* More space */
    font-size: 1.15em; /* Slightly larger font */
    line-height: 1.9; /* More readable line height */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); /* Stronger, softer shadow */
}
#generated-prompt-output .action-buttons button {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 8px;
}

/* Sign-in Modal Styles */
#signInToSaveModal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#signInToSaveModal .modal-content {
    background-color: #fefefe;
    /* margin: auto; - REMOVED THIS LINE */
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.3s ease-out;
    text-align: center;
}

#signInToSaveModal .modal-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8em;
}

#signInToSaveModal .modal-content p {
    margin-bottom: 25px;
    font-size: 1.1em;
    color: #555;
}

#signInToSaveModal .modal-content .btn-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

#signInToSaveModal .modal-content .btn-group .btn {
    width: 45%; /* Make buttons take up half width */
    padding: 12px 20px;
}
#signInToSaveModal .close-button {
    top: 15px;
    right: 25px;
}

/* Responsive Adjustments */
@media (max-width: 1023px) {
    /* No sidebar ad, so main content area takes full width */
    .main-content-area {
        width: 100%;
        max-width: 100%; /* Ensure it expands */
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px; /* Slightly smaller base font on mobile */
    }
    .container {
        margin: 15px;
        padding: 20px;
        border-radius: 12px;
        gap: 20px;
    }
    header {
        padding: 12px 0;
        margin-bottom: 20px;
    }
    header h1 {
        font-size: 2em;
    }
    nav ul {
        flex-direction: column;
        gap: 10px;
    }
    nav ul li a {
        padding: 8px 15px;
        font-size: 0.95em;
    }
    .form-container {
        margin: 20px 0;
        padding: 25px;
        border-radius: 12px;
    }
    .form-container h2 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }
    .form-group label {
        font-size: 1em;
        margin-bottom: 8px;
    }
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 1em;
        border-radius: 8px;
    }
    .btn {
        padding: 12px 20px;
        font-size: 1.05em;
        border-radius: 8px;
    }
    .message {
        padding: 12px;
        margin-bottom: 20px;
        font-size: 1em;
        border-radius: 8px;
    }
    .google-signin-btn {
        padding: 10px;
        font-size: 1em;
        border-radius: 8px;
    }
    .google-signin-btn img {
        width: 24px;
        height: 24px;
        margin-right: 10px;
    }

    .prompt-card, .history-card {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    .prompt-card h3, .history-card h3 {
        font-size: 1.3em;
        padding-bottom: 8px;
        margin-bottom: 8px;
    }
    .prompt-card p, .history-card p {
        font-size: 1em;
        margin-bottom: 10px;
    }
    .prompt-card .meta-info span, .history-card .meta-info span {
        margin-right: 10px;
        display: block; /* Stack meta info on mobile */
    }
    .prompt-card .actions, .history-card .actions {
        text-align: center;
        margin-top: 15px;
    }
    .prompt-card .actions button, .history-card .actions button {
        margin: 5px;
        width: calc(50% - 10px); /* Two buttons per row */
        display: inline-block;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
    .filter-controls .form-group {
        min-width: unset;
        width: 100%;
    }
    .filter-controls input[type="text"],
    .filter-controls select,
    .filter-controls button {
        padding: 10px;
        font-size: 1em;
        border-radius: 8px;
    }
    .filter-controls button {
        width: 100%;
    }

    /* Generate Prompt Page Specific Mobile Adjustments */
    .prompt-generator-container {
        padding: 25px;
        margin: 20px auto;
        border-radius: 12px;
        max-width: 100%; /* Allow full width on mobile */
    }
    .discipline-selection {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 10px;
        margin-bottom: 20px;
    }
    .discipline-selection label {
        padding: 12px 20px;
        font-size: 1em;
        border-radius: 10px;
    }
    .modifiers-section {
        padding: 20px;
        margin-top: 25px;
        border-radius: 10px;
    }
    .modifier-group label {
        font-size: 1.05em;
        margin-bottom: 10px;
    }
    .modifier-options {
        flex-direction: column; /* Stack checkboxes on mobile */
        gap: 8px;
    }
    .modifier-options input[type="checkbox"] + label {
        width: 100%; /* Full width for checkboxes */
        text-align: center;
        padding: 10px 15px;
        border-radius: 10px;
    }
    #generated-prompt-output {
        padding: 20px;
        margin-top: 30px;
        font-size: 1.05em;
        border-radius: 12px;
    }
    #generated-prompt-output .action-buttons button {
        width: calc(50% - 10px);
        margin: 5px;
        display: inline-block;
    }
}
