* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1 0 auto;
    width: 100%;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.header-nav a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
}

.header-nav a:hover {
    color: var(--brand-primary);
}

/* Nav Conversation Link with Unread Badge */
.nav-conversations {
    position: relative;
}

.unread-badge {
    display: none;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    vertical-align: super;
    margin-left: 2px;
    animation: badgePopIn 0.3s ease;
}

.unread-badge.has-unread {
    display: inline-block;
}

@keyframes badgePopIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Footer */
.footer {
    background: #1e1e2f;
    color: white;
    padding: 28px 20px;
    text-align: center;
    flex-shrink: 0;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0;
    opacity: 0.7;
    font-size: 0.9rem;
}

.footer-links {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: rgba(255,255,255,0.9);
    text-decoration: underline;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--brand-primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #333;
}

/* Page Header */
.page-header {
    background: var(--brand-gradient);
    color: white;
    padding: 48px 20px;
    text-align: center;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.page-header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Button Icon Helper */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* Status Badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.online,
.status-badge.available {
    background: #d4edda;
    color: #155724;
}

.status-badge.offline,
.status-badge.unavailable {
    background: #e9ecef;
    color: #6c757d;
}

/* Skill Tag */
.skill-tag {
    background: var(--brand-gradient);
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
}

/* Avatar Placeholder */
.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    background: var(--brand-gradient);
}

/* Profile City */
.profile-city {
    color: #666;
    font-size: 0.95rem;
}

/* Profile Actions */
.profile-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Error Messages */
.error-messages {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.error-message {
    margin-bottom: 4px;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 4px;
}



/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

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

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

/* Links */
.links {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.links a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
}

.links a:hover {
    text-decoration: underline;
}

/* Favorites Button */
.fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 5;
    line-height: 1;
}
.fav-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.fav-btn.fav-active {
    color: #f59e0b;
    background: rgba(255,255,255,1);
}
.fav-btn.fav-active:hover {
    color: #d97706;
}

.profile-card-wrapper {
    position: relative;
}

/* Favorite button for detail pages (btn style) */
.btn-outline.fav-active,
.jd-btn-secondary.fav-active {
    color: #f59e0b;
    border-color: #f59e0b;
}

/* ===== Hamburger Menu Button ===== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    z-index: 210;
    position: relative;
}

.hamburger:hover {
    background: rgba(0,0,0,0.05);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #666;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger span + span {
    margin-top: 5px;
}

/* Hamburger -> X animation */
.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== Mobile Nav Drawer & Backdrop ===== */
.nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
}

.nav-backdrop.active {
    opacity: 1;
    pointer-events: auto;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .header-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(320px, 85vw);
        height: 100vh;
        height: 100dvh;
        background: white;
        flex-direction: column;
        padding: 80px 24px 32px;
        gap: 4px;
        box-shadow: -4px 0 24px rgba(0,0,0,0.08);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .header-nav.mobile-open {
        right: 0;
    }

    .header-nav .nav-link {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        border-radius: 10px;
        font-size: 1rem;
        color: #444;
        transition: background 0.15s, color 0.15s;
        text-decoration: none;
        font-weight: 500;
        cursor: pointer;
    }

    .header-nav .nav-link:hover {
        background: #f0f2ff;
        color: var(--brand-primary);
    }

    .header-nav .nav-link:active {
        background: #e0e3ff;
    }

    /* Badges inside mobile nav links */
    .header-nav .nav-link .fav-badge,
    .header-nav .nav-link .admin-badge {
        position: static;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 8px;
        min-width: 22px;
        height: 22px;
        font-size: 0.7rem;
        line-height: 22px;
        vertical-align: middle;
    }

    .header-nav .nav-link .unread-badge.has-unread {
        position: static;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 8px;
        min-width: 22px;
        height: 22px;
        font-size: 0.7rem;
        line-height: 22px;
        vertical-align: middle;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 12px 16px;
    }

    .header-logo {
        font-size: 1.25rem;
    }

    .header-nav {
        width: 100vw;
        max-width: 100%;
        right: -100%;
        padding: 72px 16px 24px;
    }

    .header-nav.mobile-open {
        right: 0;
    }

    .header-nav .nav-link {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
}
