/* Smallbox Visitors Plugin Styles */

.sbv-form {
    --color-background-dark: #2e3333;
    --color-text: #2e3333;
    --color-orange: #e98300;
    --color-teal: #55d4e5;
    --color-yellow: #e2d313;
    --color-blue: #5454ef;
    max-width: 800px;
    margin: 0 auto;
    padding-inline: clamp(15px, 5vw, 60px);
    padding-block: clamp(30px, 5vw, 60px);
    background: #fff;
}

.sbv-form h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--color-text);
}

.sbv-form label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
}

.sbv-form input[type="text"],
.sbv-form input[type="email"],
.sbv-form input[type="password"],
.sbv-form select {
    width: 100%;
    padding: 8px 12px;
    margin-top: 4px;
    border: 2px solid var(--color-text);
    border-radius: 0;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 50px;
}

.sbv-form input[type="text"]:focus,
.sbv-form input[type="email"]:focus,
.sbv-form input[type="password"]:focus,
.sbv-form select:focus {
    outline: none;
    border-color: var(--color-orange);
}

/* Fieldset and radio button styles */
.sbv-form fieldset {
    border: 2px solid var(--color-text);
    border-radius: 0;
    padding: 12px;
    margin-bottom: 15px;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.sbv-form fieldset:focus-within {
    border-color: var(--color-orange);
}

.sbv-form legend {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    padding: 0 8px;
}

.sbv-form fieldset label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
}

.sbv-form input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
    min-height: auto;
    cursor: pointer;
}

.sbv-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.sbv-form-row label {
    flex: 1;
    margin-bottom: 0;
}

/* Required field indicators */
.sbv-required-note {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.sbv-required-asterisk {
    color: #d63384;
    font-weight: bold;
    margin-left: 4px;
}

.sbv-form fieldset legend .sbv-required-asterisk {
    margin-left: 4px;
}

/* Password match indicator */
.sbv-password-match-indicator {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 5px;
    margin-bottom: 15px;
}

.sbv-password-match-indicator.match {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.sbv-password-match-indicator.no-match {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.sbv-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--color-text);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: .925rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    cursor: pointer;
    margin-top: 10px;
}

.sbv-form button[type="submit"]:hover {
    background: var(--color-orange);
}

.sbv-form p {
    text-align: left;
    margin-top: 15px;
}

.sbv-form a {
    color: var(--color-orange);
    text-decoration: none;
}

.sbv-form a:hover {
    text-decoration: underline;
}

.sbv-auth-status {
    text-align: center;
    padding: 15px;
    font-style: italic;
    color: #666;
}

.sbv-logged-in {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
}

@media screen and (max-width: 600px) {
    .sbv-logged-in {
        padding: 30px 10px;
    }
}

/* Style elements when user is authenticated with SBV */
body[data-sbv-authenticated="true"] .sbv-auth-only {
    display: block;
}

body[data-sbv-authenticated="false"] .sbv-auth-only {
    display: none;
}

/* Different styling based on auth state */
body[data-sbv-authenticated="true"] .sbv-no-auth {
    display: none;
}
body[data-sbv-authenticated="false"] .sbv-no-auth {
    display: block;
}


.sbv-user-library {
    margin: 15px 0;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.sbv-user-info {
    display: flex;
    gap: 20px;
}

@media screen and (max-width: 600px) {
    .sbv-user-info {
        flex-direction: column;
    }
}

.sbv-user-details {
    background: #2e3333;
    padding: 40px;
    color: white;
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    & p {
        margin-bottom: 0;
        margin-top: 0;
        line-height: 1;
    }
    & .sbv-user-name {
        font-size: clamp(2rem, 5vw, 3rem);
        font-weight: 700;
        margin: 0;
    }

    & .sbv-user-role {
        font-size: .75rem;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        font-weight: 700;
        padding-top: 1.5rem;
    }

    & .sbv-user-school {
        font-size: 1.5rem;
        font-weight: 700;
    }
}

@media screen and (max-width: 600px) {
    .sbv-user-details {
        padding: 30px 10px;
    }

    .sbv-user-school {
        font-size: 1.25rem !important;
    }
}


/* Hide elements with hidden attribute */
[hidden] {
    display: none !important;
}

/* Edit profile specific styles */
.sbv-user-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.sbv-user-actions button {
    padding: 15px 20px;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 2px solid #2e3333;
    background-color: #fff;
    text-align: left;

    &:focus,
    &:hover {
        background-color: #f4f4f4;
        border-color: #e98300;
    }
}



.sbv-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.sbv-form-actions button {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--color-text);
    cursor: pointer;
    font-size: .875rem;
    min-height: 50px;
    box-sizing: border-box;
}

.sbv-form-actions button[type="submit"] {
    background: #e98300;
    color: white;
    min-height: 60px;
    margin: 0;
}

.sbv-form-actions button[type="submit"]:hover {
    background: #218838;
}

.sbv-form-actions button[data-sbv-cancel-edit] {
    background: #6c757d;
    color: white;
}

.sbv-form-actions button[data-sbv-cancel-edit]:hover {
    background: #545b62;
}

.sbv-field-note {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
    font-style: italic;
}

.sbv-form input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

/* Responsive styles for mobile devices */
@media (max-width: 599px) {
    .sbv-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .sbv-form-row label {
        margin-bottom: 15px;
    }
}

/* Library view styles */
.sbv-library-content {
    margin: 20px 0;
}

.sbv-bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.sbv-bookmarks-header h4 {
    margin: 0;
    color: var(--color-text);
}

.sbv-bookmark-count {
    font-size: 14px;
    color: #fff;
    background-color: #e98300;
}

.sbv-bookmarks-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sbv-bookmark-item {
    padding: 15px;
    border: 2px solid #2e3333;
    border-radius: 0;
    background: #fafafa;
}

.sbv-bookmark-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.sbv-bookmark-title {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.sbv-bookmark-title a {
    color: var(--color-text);
    text-decoration: none;
}

.sbv-bookmark-title a:hover {
    color: var(--color-orange);
    text-decoration: underline;
}

.sbv-bookmark-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sbv-bookmark-link {
    color: var(--color-orange);
    text-decoration: none;
    font-size: 14px;
}

.sbv-bookmark-link:hover {
    text-decoration: underline;
}

.sbv-remove-bookmark {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.sbv-remove-bookmark:hover {
    background: #c82333;
}

.sbv-no-bookmarks {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.sbv-no-bookmarks p {
    margin: 10px 0;
}

.sbv-loading, .sbv-error {
    text-align: center;
    padding: 20px;
    color: #666;
}

.sbv-error {
    color: #dc3545;
}

/* Notification Preferences Styles */
.sbv-notifications-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid #444;
}

.sbv-notifications-section h3 {
    color: var(--color-text);
    margin-bottom: 20px;
}

.sbv-notifications-form {
    max-width: none;
    padding: 0;
    background: none;
    margin-bottom: 60px;
}

.sbv-toggle-field {
    margin-bottom: 20px;
    padding: 15px;
    border: 2px solid #444;
    background: #fafafa;
}

.sbv-toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
    width: 100%;
}

.sbv-toggle-info {
    flex: 1;
    margin-right: 20px;
}

.sbv-toggle-text {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 4px;
}

.sbv-toggle-description {
    display: block;
    font-size: 0.875rem;
    color: #666;
    line-height: 1.4;
}

.sbv-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    flex-shrink: 0;
}

.sbv-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sbv-toggle-slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 4px;
    top: 4px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sbv-toggle-switch input:checked + .sbv-toggle-slider {
    background-color: #e98300;
}

.sbv-toggle-switch input:checked + .sbv-toggle-slider:before {
    transform: translateX(30px);
}

.sbv-toggle-switch:hover .sbv-toggle-slider {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

/* Form status for notifications */
.sbv-form-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.875rem;
}

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

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

/* Responsive design for toggle switches */
@media (max-width: 600px) {
    .sbv-toggle-label {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sbv-toggle-info {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .sbv-toggle-switch {
        align-self: flex-start;
    }
}

/* Messaging System Styles */
.sbv-messages-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

.sbv-messages-section h3 {
    margin-bottom: 20px;
    color: var(--color-text);
}

.sbv-messages-container {
    margin-bottom: 20px;
}

/* Thread views with smooth transitions */
.sbv-thread-list,
.sbv-thread-detail {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    opacity: 1;
    transform: translateX(0);
}

.sbv-thread-list.sbv-fade-out {
    opacity: 0;
    transform: translateX(-20px);
}

.sbv-thread-detail.sbv-fade-out {
    opacity: 0;
    transform: translateX(20px);
}

.sbv-thread-list.sbv-fade-in {
    opacity: 1;
    transform: translateX(0);
}

.sbv-thread-detail.sbv-fade-in {
    opacity: 1;
    transform: translateX(0);
}

.sbv-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.sbv-no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

.sbv-thread-item {
    border: 2px solid #2e3333;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sbv-thread-item:hover {
    border-color: var(--color-orange);
    background: #f9f9f9;
}

.sbv-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-inline: 10px;
}

.sbv-thread-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.sbv-thread-status.open {
    background: #e8f5e8;
    color: #2e7d32;
}

.sbv-thread-status.resolved {
    background: #e3f2fd;
    color: #1976d2;
}

.sbv-thread-date {
    font-size: 12px;
    color: #666;
}

.sbv-thread-preview {
    color: var(--color-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.sbv-thread-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.sbv-unread-badge {
    background: var(--color-orange);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.sbv-thread-actions {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    opacity: 1;
    transform: translateY(0);
}

.sbv-thread-actions[hidden] {
    opacity: 0;
    transform: translateY(-10px);
}

.sbv-thread-detail {
    border: 2px solid #2e3333;
    background: white;
}

.sbv-btn-back {
    background: none;
    border: none;
    color: var(--color-orange);
    cursor: pointer;
    font-size: 14px;
    padding: 5px 0;
}

.sbv-btn-back:hover {
    text-decoration: underline;
}

.sbv-thread-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.sbv-message {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.sbv-message.visitor {
    background: #f8f9fa;
}

.sbv-message.admin {
    background: #e8f5e8;
}

.sbv-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sbv-message-sender {
    font-weight: 600;
    color: var(--color-text);
}

.sbv-message-date {
    font-size: 12px;
    color: #666;
}

.sbv-message-text {
    line-height: 1.5;
    color: var(--color-text);
    white-space: pre-wrap;
}

.sbv-thread-reply {
    padding: 15px;
}

.sbv-reply-button-container {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.sbv-reply-button-container button {
    transition: all 0.2s ease;
}

.sbv-reply-button-container button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sbv-thread-reply textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.sbv-thread-reply textarea:focus {
    outline: none;
    border-color: #e98300;
}

.sbv-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.sbv-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sbv-btn-primary {
    background: #e98300;
    color: white;
}

.sbv-btn-primary:hover {
    background: #d17200;
}

.sbv-btn-secondary {
    background: #f0f0f0;
    color: var(--color-text);
}

.sbv-btn-secondary:hover {
    background: #e0e0e0;
}

.sbv-thread-resolved {
    padding: 15px;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

/* Modal Styles */
.sbv-new-thread-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.sbv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.sbv-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.sbv-modal-header h4 {
    margin: 0;
    color: var(--color-text);
}

.sbv-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbv-modal-close:hover {
    color: var(--color-text);
}

.sbv-modal-body {
    padding: 20px;
}

.sbv-modal-body textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.sbv-modal-body textarea:focus {
    outline: none;
    border-color: var(--color-orange);
}

.sbv-modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 600px) {
    .sbv-thread-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sbv-thread-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .sbv-form-actions {
        flex-direction: column;
    }
    
    .sbv-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .sbv-modal-footer {
        flex-direction: column;
    }
}
