/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #3b5998;
    --secondary-color: #e1306c;
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --text-color: #1c1e21;
    --light-text-color: #606770;
    --border-color: #dddfe2;
    --success-color: #42b72a;
    --error-color: #fa3e3e;
    --warning-color: #f5a623;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 10px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Prompt', sans-serif; background-color: var(--background-color); color: var(--text-color); line-height: 1.6; font-size: 16px; }
.container { max-width: 1100px; margin: 2rem auto; padding: 1.5rem 2rem; background-color: var(--card-background); border-radius: var(--border-radius); box-shadow: var(--shadow); }
h1 { color: var(--primary-color); text-align: center; margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 2rem; }
.header-icon { width: 36px; height: 36px; margin-right: 12px; vertical-align: middle; }
.subtitle { text-align: center; color: var(--light-text-color); margin-bottom: 2.5rem; font-size: 1.1rem; }
hr { border: 0; height: 1px; background-color: var(--border-color); margin: 2.5rem 0; }

/* Toggle Button */
#toggle-form-btn { display: block; width: fit-content; margin: 0 auto 2rem auto; padding: 0.8rem 2rem; font-family: 'Prompt', sans-serif; font-size: 1.05rem; font-weight: 500; color: #fff; background: linear-gradient(45deg, var(--secondary-color), #ff7e5f); border: none; border-radius: 25px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
#toggle-form-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); }

/* Form Section */
#form-section { background-color: #f9f9f9; padding: 2rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin-bottom: 2.5rem; }
#form-section h2 { text-align: center; margin-bottom: 2rem; color: var(--primary-color); font-weight: 500; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.6rem; font-weight: 500; color: var(--light-text-color); font-size: 0.95rem; }
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea, /* Add textarea */
.form-group input[type="file"]
{ width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: 'Prompt', sans-serif; font-size: 1rem; transition: border-color 0.3s ease, box-shadow 0.3s ease; line-height: 1.5; /* Ensure textarea line height is good */ }
.form-group textarea { resize: vertical; /* Allow vertical resize only */ min-height: 60px; }
.form-group input[type="file"] { padding: 0.5rem; cursor: pointer; }
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.2); }
.form-group small { display: block; font-size: 0.85rem; color: var(--light-text-color); margin-top: 0.4rem; }
form button[type="submit"] { display: block; width: 100%; padding: 0.9rem; font-family: 'Prompt', sans-serif; font-size: 1.15rem; font-weight: 500; color: #fff; background-color: var(--primary-color); border: none; border-radius: 6px; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; margin-top: 1.5rem; }
form button[type="submit"]:hover { background-color: #365492; transform: translateY(-2px); }

/* Character Counter Style */
#caption-char-count {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--light-text-color);
    margin-top: -0.8rem; /* Position below textarea */
    margin-bottom: 1.2rem; /* Space below counter */
    padding-right: 0.2rem;
}

/* Status Messages Container & Style */
#status-message-container { margin-top: 1.5rem; }
#status-message-container:has(.status-message) { margin-bottom: 1.5rem; }
.status-message { padding: 1rem; border-radius: 6px; text-align: center; font-weight: 500; border: 1px solid transparent; }
.status-message.success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.status-message.error, .status-message.invalid_input { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.status-message.exists { background-color: #fff3cd; color: #856404; border-color: #ffeeba; }


/* Major Radio Buttons */
.major-fieldset { border: 1px solid var(--border-color); border-radius: 6px; padding: 1rem 1rem 0.5rem 1rem; margin-bottom: 1.2rem; }
.major-fieldset legend { padding: 0 0.5rem; font-weight: 500; color: var(--light-text-color); margin-left: 0.5rem; font-size: 0.95rem; }
.radio-option { margin-bottom: 0.9rem; display: flex; align-items: center; cursor: pointer; }
.radio-option input[type="radio"] { margin-right: 0.8rem; accent-color: var(--primary-color); cursor: pointer; width: 18px; height: 18px; flex-shrink: 0; }
.radio-option label { margin-bottom: 0; font-weight: 400; color: var(--text-color); cursor: pointer; flex-grow: 1; font-size: 0.98rem; }

/* Filter and Search Section Styles */
.filter-search-section {
    background-color: #f9f9f9;
    padding: 1.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 2.5rem;
}
.filter-search-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1.4rem;
}
.filter-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.filter-group {
    flex: 1 1 10px; /* User's fix retained */
    min-width: 200px;
}
.search-group {
    flex: 1 1 10px; /* User's fix retained */
    min-width: 150px;
}
.filter-search-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--light-text-color);
    font-size: 0.9rem;
}
.filter-search-form select,
.filter-search-form input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Prompt', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.filter-search-form select:focus,
.filter-search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.2);
}
.filter-submit-btn {
    padding: 0.75rem 1.5rem;
    font-family: 'Prompt', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background-color: var(--secondary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
    height: fit-content;
    line-height: 1.4;
}
.filter-submit-btn:hover {
    background-color: #c8235a;
    transform: translateY(-1px);
}


/* Profiles Grid Title */
h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-weight: 500;
    text-align: center;
    font-size: 1.6rem;
}

/* Profiles Grid */
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.8rem; }
.profile-link { text-decoration: none; color: inherit; display: block; height: 100%; }

.profile-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1rem; /* Added padding */
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.profile-card:hover { transform: translateY(-6px); box-shadow: var(--card-hover-shadow); }

.profile-pic {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: var(--border-radius); /* Match card radius */
    margin-bottom: 1rem;
    background-color: #eee;
}

.profile-card .profile-content {
    padding: 0; /* Remove specific padding, rely on card padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    margin-top: 0.5rem; /* Space below image */
}

.profile-card h3 { margin-bottom: 0.4rem; font-size: 1.2rem; font-weight: 500; color: var(--text-color); word-break: break-word; }
.profile-card p.major-tag { color: var(--light-text-color); font-size: 0.9rem; margin-bottom: 1rem; background-color: #eee; padding: 0.2rem 0.6rem; border-radius: 10px; display: inline-block; flex-grow: 0; }

/* <<< Added Caption Text Style >>> */
.profile-card .caption-text {
    font-size: 0.9rem;
    color: var(--light-text-color);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    font-style: italic;
    word-break: break-word;
    padding: 0 0.5rem;
    line-height: 1.4;
    flex-grow: 0; /* Don't let caption grow excessively */
}

.profile-card .view-profile-btn { display: inline-block; margin-top: auto; padding: 0.6rem 1.2rem; background-color: var(--primary-color); color: #fff; border-radius: 20px; font-size: 0.9rem; font-weight: 500; transition: background-color 0.3s ease, transform 0.2s ease; }
.profile-card:hover .view-profile-btn { background-color: var(--secondary-color); transform: scale(1.05); }
.no-results { grid-column: 1 / -1; text-align: center; color: var(--light-text-color); font-size: 1.1rem; padding: 3rem 1rem; background-color: #f9f9f9; border-radius: var(--border-radius); }

/* Footer */
footer { text-align: center; margin-top: 3rem; padding: 1.5rem; color: var(--light-text-color); font-size: 0.9rem; border-top: 1px solid var(--border-color); }

/* Crop 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.6); }
.modal-content { background-color: #fefefe; margin: 8% auto; padding: 25px; border: 1px solid #888; width: 90%; max-width: 600px; position: relative; border-radius: var(--border-radius); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.close-btn { color: #aaa; position: absolute; top: 10px; right: 20px; font-size: 30px; font-weight: bold; cursor: pointer; line-height: 1; }
.close-btn:hover, .close-btn:focus { color: black; text-decoration: none; }
.modal-content h2 { text-align: center; margin-bottom: 1.5rem; color: var(--primary-color); }
.img-container { width: 100%; max-height: 45vh; margin-bottom: 1.5rem; background-color: #f0f0f0; }
#image_to_crop { display: block; max-width: 100%; max-height: 45vh; }
#crop_button { background-color: var(--primary-color); color: white; padding: 12px 24px; border: none; border-radius: 5px; cursor: pointer; font-size: 1.05rem; margin-top: 10px; display: block; margin-left: auto; margin-right: auto; }
#crop_button:hover { background-color: #365492; }

/* ---------- Pagination Styles ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 0.5rem; /* Space between links */
    margin-top: 3rem; /* Space above pagination */
    padding: 1rem 0;
    border-top: 1px solid var(--border-color); /* Separator line */
}

.page-link {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
    background-color: var(--card-background);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap; /* Prevent wrapping inside link */
}

.page-link:hover {
    background-color: #f0f2f5; /* Light background on hover */
    border-color: #c9ced4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.page-link.active {
    background-color: var(--primary-color);
    color: var(--card-background);
    border-color: var(--primary-color);
    cursor: default;
    box-shadow: none;
}

.page-link.disabled {
    color: #adb5bd; /* Light gray color */
    background-color: #e9ecef; /* Lighter background */
    border-color: #dee2e6;
    cursor: not-allowed;
    box-shadow: none;
}
.page-link.disabled:hover {
     background-color: #e9ecef; /* Prevent hover effect */
}

.page-link.prev, .page-link.next {
    /* Optional: specific styles for prev/next */
}

.page-link.dots {
    border: none;
    background: none;
    padding: 0.6rem 0.5rem;
    color: var(--light-text-color);
    cursor: default;
}
.page-link.dots:hover {
    background: none;
    box-shadow: none;
}

/* Responsive Pagination */
@media (max-width: 480px) {
    .pagination {
        gap: 0.3rem; /* Reduce gap further */
        justify-content: center;
    }
    .page-link {
        padding: 0.5rem 0.8rem; /* Smaller padding */
        font-size: 0.85rem;
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .container { margin: 1rem; padding: 1rem 1.5rem; }
    h1 { font-size: 1.8rem; }
    .profiles-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.2rem; }
    #form-section { padding: 1.5rem; }
    .profile-card { padding: 0.8rem; }
    .modal-content { width: 90%; margin: 15% auto; }
    .filter-search-section { padding: 1.2rem 1.5rem; }
}

/* --- Mobile adjustments (600px and below) --- */
@media (max-width: 600px) {
    .filter-search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }
    .filter-submit-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    .filter-group,
    .search-group {
        margin-bottom: 0;
    }
    .filter-search-section {
        padding: 1rem 1.2rem;
    }
    #form-section { padding: 1.2rem; }
}


@media (max-width: 480px) {
    body { font-size: 15px; }
    .container { margin: 0.5rem; padding: 1rem; }
    h1 { font-size: 1.6rem; }
    .subtitle { font-size: 1rem; margin-bottom: 2rem; }
    .profiles-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    #toggle-form-btn { width: 90%; font-size: 1rem; }
    .form-group input, .form-group textarea, form button[type="submit"] { font-size: 0.95rem; padding: 0.7rem 0.8rem; }
    form button[type="submit"] { font-size: 1rem; }
    .profile-card { padding: 0.6rem; }
    .profile-card h3 { font-size: 1.1rem; }
    .profile-card p.major-tag { font-size: 0.85rem; }
    .profile-card .caption-text { font-size: 0.85rem; margin-bottom: 0.8rem; } /* Adjust caption style */
    .profile-card .view-profile-btn { font-size: 0.85rem; padding: 0.5rem 1rem; }
    .modal-content { padding: 20px; margin: 10% auto; }
    #crop_button { padding: 10px 15px; font-size: 1rem;}

    .filter-search-section {
        padding: 0.8rem 1rem;
    }
    .filter-search-form {
        gap: 0.6rem;
    }
    .filter-search-form label { font-size: 0.85rem; }
    .filter-search-form select, .filter-search-form input[type="text"] { font-size: 0.9rem; padding: 0.6rem 0.8rem;}
    .filter-submit-btn { font-size: 0.9rem; padding: 0.7rem 1.2rem; }

}