@import url("theme.css");
@import url("components.css");

/* =====================================================
   Tanglaw - GLOBAL CSS (Base Styles + Variables + Reset)
   ===================================================== */

/* ----------------------------- */
/* CSS RESET (Clean slate)       */
/* ----------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: "Inter", Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    /* Helps native form controls match the dark theme */
    color-scheme: dark;
    overflow-x: hidden;
}


/* ----------------------------- */
/* MOBILE BASELINE (UX)          */
/* ----------------------------- */
html, body{
    width: 100%;
    overflow-x: hidden;
}

body{
    -webkit-tap-highlight-color: transparent;
}

img, video, canvas{
    max-width: 100%;
    height: auto;
}

/* Better focus for keyboard users */
:focus-visible{
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
    border-radius: 8px;
}
body {
    /* Subtle "night sky" glow for a premium feel */
    background:
        radial-gradient(900px circle at 10% 10%, var(--glow-primary), transparent 45%),
        radial-gradient(900px circle at 90% 20%, var(--glow-accent), transparent 50%),
        var(--bg-main);
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

input, textarea {
    outline: none;
    border: none;
    color: var(--text-main);
}

::placeholder {
    color: var(--text-dim);
    opacity: 0.9;
}

/* ----------------------------- */
/* CSS VARIABLES (Theme Colors)  */
/* ----------------------------- */
/* Theme variables moved to theme.css */


/* ----------------------------- */
/* FORM CONTROLS (BASELINE)      */
/* ----------------------------- */
/* Keep selectors low-specificity so component/page-specific rules can override. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select,
textarea{
    font: inherit;
    color: var(--text-main);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    min-height: 44px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea{ min-height: 110px; resize: vertical; }

input:focus,
select:focus,
textarea:focus{
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

input:disabled,
select:disabled,
textarea:disabled{
    opacity: 0.7;
    cursor: not-allowed;
}

/* ----------------------------- */
/* CONTAINERS & GLOBAL SECTIONS  */
/* ----------------------------- */
.app-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

h1, h2, h3, h4 {
    color: var(--text-main);
}

p {
    color: var(--text-light);
}

/* ----------------------------- */
/* BUTTONS                       */
/* ----------------------------- */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-small {
    background: var(--primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-md);
}

.btn-secondary {
    background: var(--surface-3);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--primary);
}

.btn-small.btn-danger {
    background: var(--danger);
    padding: 6px 10px;
}

/* ----------------------------- */
/* MODALS (GLOBAL)               */
/* ----------------------------- */
.tlw-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

.tlw-modal {
    width: min(520px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 18px 18px 14px;
}


/* Modal sub-structure (used by appointment dashboards & dialogs) */
.tlw-modal-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.tlw-modal-close{
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.tlw-modal-close:hover{
    transform: translateY(-1px);
    background: var(--surface-3);
}

.tlw-modal-body{ margin-top: 8px; }

.tlw-modal-footer{
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tlw-modal-field{
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.tlw-modal-field label{
    font-weight: 800;
    color: var(--text-main);
}

.tlw-modal-field textarea{
    background: var(--surface-3);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-main);
}

.tlw-modal-error{
    color: var(--danger);
    font-size: 0.9rem;
    min-height: 1em;
}

.tlw-modal-title {
    font-size: 1.12rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tlw-modal-desc {
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 12px;
}

.tlw-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.tlw-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.tlw-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.tlw-modal .btn-danger:disabled,
.tlw-modal .btn-secondary:disabled,
.tlw-modal .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ----------------------------- */
/* FORM ELEMENTS                 */
/* ----------------------------- */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    background: var(--surface-3);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-main);
    width: 100%;
    min-height: 44px;

}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ----------------------------- */
/* GLOBAL UTILITIES              */
/* ----------------------------- */
.hidden {
    display: none !important;
}

.status {
    font-weight: bold;
}

.status.active {
    color: var(--success);
}

.status.online {
    color: var(--success);
}

.status.banned {
    color: var(--danger);
}


/* =========================================================
   AVATAR SYSTEM (GLOBAL)
   Reusable avatar component for all roles/pages
   ---------------------------------------------------------
   avatar-xs  → very small (status icons, lists)
   avatar-sm  → small (chat lists)
   avatar-md  → medium (profile headers)
   avatar-lg  → large (settings/profile page)
   ========================================================= */

.avatar-xs,
.avatar-sm,
.avatar-md,
.avatar-lg,
.user-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}


/* Extra-small avatar (20×20) */
.avatar-xs {
    width: 20px;
    height: 20px;
}

/* Small avatar (32×32) */
.avatar-sm,
.user-avatar {     /* AUTO-applies to your existing user list UI */
    width: 32px;
    height: 32px;
}

/* Medium avatar (48×48) */
.avatar-md {
    width: 48px;
    height: 48px;
}

/* Large avatar (96×96) – for profiles/settings */
.avatar-lg {
    width: 96px;
    height: 96px;
}

img.user-avatar,
img.top-avatar {
    width: 30px ;
    height: 30px ;
    object-fit: cover ;
    border-radius: 50%;
}

/* Wrapper behavior for .user-avatar (global) */
.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;         /* para hindi lumabas yung image sa bilog */
}

/* Make image fill the avatar wrapper */
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}




.login-container,
.register-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: transparent;
}

.login-card,
.register-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.login-card h1,
.register-card h1 {
    text-align: center;
    margin-bottom: 8px;
}

.login-card h2,
.register-card h2 {
    text-align: center;
    margin-bottom: 20px;
}

/* Input fields */
.login-card input,
.register-card input {
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--surface-3);
    color: var(--text-main);
    transition: 0.2s;
}

.login-card input:focus,
.register-card input:focus {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 2px var(--ring);
    background-color: var(--surface-2);
}



/* ========================= */
/* Facilitator Auth Layout   */
/* ========================= */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: transparent;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.auth-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-align: center;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1.75rem;
}

/* Form layout */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-form label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.auth-form input,
.auth-form textarea {
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    background-color: var(--surface-3);
    color: var(--text-main);
}

.auth-form input:focus,
.auth-form textarea:focus {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 2px var(--ring);
    background-color: var(--surface-2);
}

.auth-form textarea {
    min-height: 120px;
    resize: vertical;
}

/* Submit button */

.auth-form button[type="submit"] {
    margin-top: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.auth-form button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px var(--primary-shadow-strong);
    opacity: 0.95;
}

.auth-form button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px var(--primary-shadow);
}

/* Small helper text (if you add any) */

.auth-footer-text {
    margin-top: 1.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}





/* ----------------------------- */
/* MOBILE SHEET MODALS           */
/* ----------------------------- */
@media (max-width: 640px){
    .tlw-modal-backdrop{
        align-items: flex-end;
        justify-content: center;
        padding: 12px;
    }
    .tlw-modal-content{
        width: 100%;
        max-width: 100%;
        border-radius: 18px 18px 14px 14px;
        max-height: calc(100vh - 24px);
        overflow: hidden;
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    .tlw-modal-body{
        max-height: calc(100vh - 190px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 2px;
    }
}

/* ----------------------------- */
/* TOASTS (Frameworkless)        */
/* ----------------------------- */
.tlw-toast-host{
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 36px));
}

.tlw-toast{
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.tlw-toast__dot{
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-top: 6px;
    background: var(--primary);
}

.tlw-toast--success .tlw-toast__dot{ background: var(--success); }
.tlw-toast--danger  .tlw-toast__dot{ background: var(--danger); }
.tlw-toast--info    .tlw-toast__dot{ background: var(--info); }

.tlw-toast__title{ font-weight: 900; }
.tlw-toast__msg{ color: var(--text-muted); line-height: 1.45; margin-top: 2px; }

/* ----------------------------- */
/* TOUCH + ACCESSIBILITY         */
/* ----------------------------- */
button, a, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring);
    border-radius: 10px;
}

/* ----------------------------- */
/* BUTTON SYSTEM (aliases + base)*/
/* ----------------------------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Make primary actions touch-friendly on mobile */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 44px;
}

.btn {
    background: var(--surface-3);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: 0.2s;
}

.btn:hover { background: var(--surface-2); }

.btn.primary-btn { background: var(--primary); border-color: transparent; color: #fff; }
.btn.primary-btn:hover { background: var(--primary-hover); }

.btn.secondary-btn { background: var(--surface-3); border-color: var(--border); color: var(--text-main); }
.btn.secondary-btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }

.btn.danger-btn { background: var(--danger); border-color: transparent; color: #fff; }

.btn.small-btn,
.btn.btn-small {
    padding: 6px 12px;
    min-height: 36px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-small:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ========================= */
/* Icon buttons (close etc.) */
/* ========================= */

.tlw-modal-close {
    font-size: 0;
}
.tlw-modal-close .tlw-icon { --tlw-icon-size: 18px; }
