/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Loading Screen Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingMessage {
    font-family: 'Annie Use Your Telescope', cursive;
    font-size: 1.2rem;
    color: #333;
    margin: 0;
}

/* Button loading states */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body {
    font-family: 'Annie Use Your Telescope', cursive;
    line-height: 1.4;
    color: #333;
    background-color: #fff;
    font-size: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    flex: 1 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Ensure container fills available space between header and footer */
    min-height: calc(100vh - 80px - 50px); /* 80px header, 50px footer */
}

/* Header styles */
header {
    min-height: 80px;
    margin-bottom: 40px;
    border-bottom: none;
    padding-bottom: 0;
}

.header-inner {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-bottom: none;
    padding-bottom: 0;
}

#logo{
    width: 42px;
}

.header-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex-wrap: nowrap;
    justify-content: center;
}

.header-buttons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.header-buttons-row .btn {
    font-size: 1.15rem;
    padding: 3px 18px;
    min-width: 110px;
    text-align: center;
    border-width: 1px !important;
    border-style: solid;
}

@media (max-width: 600px) {
    .header-buttons-row {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 10px;
    }
    .header-buttons .btn {
        font-size: 1rem;
        padding: 3px 10px;
    }
    .header-buttons-row .btn {
        font-size: 1rem;
        padding: 3px 10px;
    }
}

h1 {
    font-size: 2.5rem;
}

/* Button styles */
.btn {
    font-family: 'Annie Use Your Telescope', cursive;
    font-size: 1.2rem;
    padding: 5px 13px;
    border: 1px solid #333;
    border-radius: 5px;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: none;
}

/* Remove all hover, active, and focus effects for buttons */
.btn:hover,
.btn-secondary:hover,
.btn-primary:hover,
.btn-danger:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.btn:active,
.btn-secondary:active,
.btn-primary:active,
.btn-danger:active,
button:active,
input[type="submit"]:active,
input[type="button"]:active,
.btn:focus,
.btn-secondary:focus,
.btn-primary:focus,
.btn-danger:focus,
button:focus,
input[type="submit"]:focus,
input[type="button"]:focus {
    background: #fff !important;
    color: #333 !important;
    outline: none !important;
    border: 1px solid #333 !important;
    box-shadow: none !important;
}

.btn-secondary,
.btn-primary,
.btn-danger {
    background: #fff !important;
    color: #333 !important;
    border: 1px solid #333 !important;
}

.btn.btn-sm {
    font-size: 1rem;
    padding: 3px 10px;
}

.btn-secondary {
    border-color: #666;
    color: #666;
    background: #fff;
}

.btn-primary {
    background: #333;
    color: #fff;
    border-color: #333;
}

.btn-danger {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff;
}

.btn-edit {
    display: block;
    margin: 0 auto 15px auto;
}

#googleSignInBtn {
    margin-top: 15px;
}

/* About section */
.about-content {
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    width: 100%;
    max-width: 350px;
    margin: 20px auto;
    box-sizing: border-box;
    text-align: justify;
}

@media (min-width: 800px) {
  .about-content {
    max-width: 800px;
  }
}

.about-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.about-content p {
    margin-bottom: 20px;
}

blockquote {
    border-left: 2px solid #333;
    padding-left: 20px;
    margin: 20px 0;
}

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

label {
    display: block;
    margin-bottom: 5px;
}

label[for="subscribe_note"] {
    font-size: 18px;
}

.consent-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.consent-group label {
    line-height: 1.2;
    font-size: 14px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Annie Use Your Telescope', cursive;
    font-size: 1em;
}

/* Profile styles */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.profile-container .btn {
    font-size: 1rem;
    padding: 3px 10px;
}

.profile-picture {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 20px;
    border: 2px solid #ddd;
}

.username {
    color: #666;
    margin-bottom: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

.bio-section {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.edit-bio-form {
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.subscriber-stats {
    margin-bottom: 20px;
}

.subscriber-stats #subscriber_count {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    display: block;
    margin: 0 auto;
}

.email {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #888;
}

.profile-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.export-btn {
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    background: #333 !important;
    color: #fff !important;
    border-color: #333 !important;
    display: block;
    margin: 0 auto 10px auto;
}

.profile-actions-row {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    justify-content: center;
    margin: 0 auto;
}

.profile-actions-row .btn {
    flex: 1 1 0;
    min-width: 0;
    width: 50%;
}

/* Search results */
.search-container {
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    margin: 2rem auto;
}

#search_form {
    display: flex;
    width: 100%;
}

#search_username {
    flex-grow: 1;
    margin-right: 10px;
    font-size: 1.2rem;
    padding: 5px 13px;
    box-sizing: border-box;
    width: 100%;
}

#search_result {
    width: 100%;
    margin-top: 20px;
}

.search-result-card {
    border: 1px solid #eee;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.search-user-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-user-info h3,
.search-user-info .username {
    margin-bottom: 2px;
}

.search-user-info .username {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.search-user-info .subscriber-count {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.search-profile-picture {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.search-user-bio {
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

/* Footer */
footer {
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
    font-size: 18px;
    flex-shrink: 0;
}

.footer_button{
    text-decoration: none;
    color: #333;
}

/* Role selection */
.role-selection {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 40px;
}

.role-card {
    border: 1px solid #eee;
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    border-radius: 3px;
    width: 300px;
    box-sizing: border-box;
    position: relative;
}

.role-card:hover {
    border-color: #333;
}

.role-card ul {
    list-style-position: inside;
    margin-top: 10px;
}

.role-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #fff;
    color: #555;
    font-size: 0.95em;
    font-weight: bold;
    padding: 3px 12px;
    border-radius: 3px;
    border: 1px solid #bbb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    letter-spacing: 1px;
}

/* Utility classes */
.error-message {
    color: #dc3545;
    margin: 10px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.char-count {
    text-align: right;
    color: #666;
    font-size: 0.9em;
}

.header-buttons-row .btn:focus,
.header-buttons-row .btn:active {
    background: #fff !important;
    color: #333 !important;
    border-width: 1px !important;
    border-style: solid;
    outline: none !important;
    box-shadow: none !important;
}

.main-content-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

@media (max-width: 799px) {
  .main-content-wrapper {
    max-width: 350px;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 600px) {
  .role-selection {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }
  .role-card {
    width: 100%;
    max-width: 350px;
  }
}

/* Hide header buttons when role selection is visible */
#role_selection_div:target ~ header .header-buttons-row,
#role_selection_div:target ~ header .header-buttons {
  display: none !important;
}

/* Hide search button when role selection is visible */
#role_selection_div[style*="block"] ~ header .header-buttons-row #homeBtn {
  display: none !important;
}

/* Notification badge for Requests button */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #333;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    white-space: nowrap;
}

/* Make Requests button relative positioned to contain the badge */
#requestsBtn {
    position: relative;
}

/* Request card styles */
.request-card {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.request-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.subscriber-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.request-info {
    flex: 1;
}

.request-time {
    font-size: 0.9rem;
    color: #666;
}

.request-note {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    font-size: 1.1rem;
    color: #333;
    width: 100%;
    box-sizing: border-box;
}

.request-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Button styles for subscription states */
.btn-subscribed {
    background-color: #333 !important;
    color: white !important;
    border-color: #333 !important;
    cursor: not-allowed;
}

.btn-pending {
    background-color: #666 !important;
    color: white !important;
    border-color: #666 !important;
    cursor: not-allowed;
}

.btn-subscribe {
    background-color: transparent;
    color: #333;
    border-color: #333;
}

.btn-subscribe:hover {
    background-color: #333;
    color: white;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.export-options .btn {
    padding: 12px 20px;
    font-size: 16px;
    color: #fff !important;
    background: #333 !important;
    border-color: #333 !important;
}

.export-info {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #333;
}

.export-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Responsive design for modal */
@media (max-width: 600px) {
    .modal-content {
        width: 100%;
        margin: 10% auto;
    }
    .export-options {
        flex-direction: column;
        gap: 15px;
    }
}

/* New request card styles */
.request-card-v2 {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.request-header-v2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.subscriber-avatar-v2 {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.request-info-v2 {
    flex: 1;
}

.request-time-v2 {
    font-size: 0.8rem;
    color: #666;
}

.request-note-v2 {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #333;
    width: 100%;
    box-sizing: border-box;
}

.request-actions-v2 {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn.btn-sm {
    font-size: 1rem;
    padding: 3px 10px;
}

.request-card {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.request-header {
    width: 100%;
}

.subscriber-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.request-actions {
    width: 100%;
    justify-content: flex-end;
}

/* Profile completion form styles */
.profile-completion-container {
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
    box-sizing: border-box;
}

.profile-completion-container form {
    width: 100%;
    box-sizing: border-box;
}

.profile-completion-container .form-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.profile-completion-container input[type="text"],
.profile-completion-container textarea {
    width: 100%;
    box-sizing: border-box;
}

.profile-completion-container .error-message {
    color: #dc3545;
    font-size: 1rem;
    margin-top: 10px;
}

/* Policy Page Accordion */
.policy-container {
    max-width: 800px;
    margin: 40px auto;
}

.accordion {
    font-family: 'Annie Use Your Telescope', cursive;
    background-color: #f9f9f9;
    color: #333;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: left;
    outline: none;
    font-size: 1.8rem;
    transition: background-color 0.4s ease;
    margin-top: 10px;
    position: relative;
}

.accordion:hover {
    background-color: #f1f1f1;
}

.accordion.active {
    background-color: #f1f1f1;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.accordion:after {
    content: '+';
    font-size: 2rem;
    color: #777;
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

.accordion.active:after {
    content: "−";
}

.panel {
    padding: 0 18px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    margin-bottom: 10px;
}

.panel-content {
    padding: 20px 0;
}

.panel-content h2 {
    font-size: 1.4rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.panel-content ul {
    list-style: none;
    padding-left: 10px;
}

.panel-content a {
    color: #333;
    text-decoration: underline;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f9f9f9;
    padding: 15px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #ddd;
}

.cookie-banner p {
    margin: 0;
    font-size: 1rem;
}

.cookie-banner a {
    color: #333;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner p {
        margin-bottom: 10px;
    }
}

/* Normalize button styles for mobile and desktop */
button,
input[type="submit"],
input[type="button"] {
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #333 !important;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 1rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: none;
}

button:active,
input[type="submit"]:active,
input[type="button"]:active {
  background: #e0e0e0;
}

button:focus,
input[type="submit"]:focus,
input[type="button"]:focus {
  outline: 2px solid #333;
}

/* Click (active) effect for all buttons */
.btn:active,
.btn-secondary:active,
.btn-primary:active,
.btn-danger:active,
button:active,
input[type="submit"]:active,
input[type="button"]:active {
  background: #e0e0e0 !important;
  color: #333 !important;
}

.btn-primary:active {
  background: #222 !important;
  color: #fff !important;
}

.btn-secondary:active {
  background: #444 !important;
  color: #fff !important;
}

.btn-danger:active {
  background: #b71c1c !important;
  color: #fff !important;
}

#saveBioBtn {
  background: #fff !important;
  color: #333 !important;
  border: 1px solid #333 !important;
}
#saveBioBtn:hover {
  background: #333 !important;
  color: #fff !important;
}

.btn.btn-primary[type="submit"] {
    color: #333 !important;
}

#accept-cookies {
    color: #333 !important;
}

button:active, .btn:active {
    border: none !important;
}