/* SmartThrift Custom Stylesheet */
:root {
    --bg-primary: #3A413F;
    --bg-secondary: #48524F;
    --bg-darker: #2D3331;
    --text-primary: #FFFFFF;
    --text-muted: #B3C1BD;
    --text-dark: #333333;
    --accent-red: #C04851;
    --accent-red-hover: #A53C44;
    --nav-bg: #807667;
    --nav-text: #FFFFFF;
    --nav-active: #EAE6DF;
    --card-bg: #56615E;
    --card-border: rgba(255, 255, 255, 0.1);
    --input-bg: #FFFFFF;
    --input-border: #CCCCCC;
    --success: #52B788;
    --info: #4EA8DE;
    --warning: #F7B538;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    background-color: #1E2221;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* App Container - Mobile Device Simulation on Desktop */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background-color: var(--bg-primary);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Responsive adjustments for true mobile and tablet devices */
@media (max-width: 480px) {
    .app-container {
        height: 100%;
        height: 100dvh;
        max-width: 100%;
        box-shadow: none;
    }
}

@media (min-width: 481px) and (max-width: 1024px) {
    /* Tablet Portrait */
    .app-container {
        max-width: 600px;
        height: 95vh;
        border-radius: 20px;
    }
}

@media (min-width: 1025px) {
    .app-container {
        height: 92vh;
        border-radius: 28px;
        border: 8px solid #282B2A;
    }
}

/* Scrollable Main Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 90px; /* space for bottom navigation */
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    position: relative;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.app-content::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

/* Common Header Styles */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background-color: var(--bg-primary);
    z-index: 10;
    min-height: 60px;
}

.header-bar .back-btn {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    cursor: pointer;
    background: none;
    border: none;
}

.header-bar .title {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: capitalize;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

.header-logo {
    height: 90px;
    width: auto;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.welcome-logo-img {
    height: 200px;
    width: auto;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.05));
}


.header-bar .action-icon {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent-red);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background-color: var(--input-bg);
    color: var(--text-dark);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-input::placeholder {
    color: #999;
}

.form-input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(192, 72, 81, 0.2);
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background-color: var(--input-bg);
    color: var(--text-dark);
    font-size: 1rem;
    outline: none;
}

.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background-color: var(--input-bg);
    color: var(--text-dark);
    font-size: 1rem;
    outline: none;
    min-height: 120px;
    resize: none;
}

/* Splash and Welcome Styles */
.welcome-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 40px;
    margin-bottom: 30px;
}

.welcome-logo {
    font-size: 5rem;
    font-weight: 300;
    background: linear-gradient(135deg, #A8DADC, #457B9D);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
    letter-spacing: -2px;
}

.logo-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-top: -10px;
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.3;
}

.oauth-button {
    display: flex;
    align-items: center;
    background-color: #FFFFFF;
    color: #333333;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
    cursor: pointer;
    width: 100%;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.oauth-button:hover {
    background-color: #F1F1F1;
}

.oauth-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
}

.oauth-text {
    flex: 1;
    text-align: left;
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 25px;
    font-size: 0.95rem;
    cursor: pointer;
}

.checkbox-container input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.welcome-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Home / Beranda styles */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.product-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-image-wrapper {
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    position: relative;
    background-color: var(--bg-darker);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Explore / Jelajah Page */
.search-container {
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: 25px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    margin-left: 10px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.category-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

.category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.category-btn:hover {
    transform: translateY(-2px);
}

.category-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.category-btn.active .category-icon-wrapper {
    background-color: var(--accent-red);
    box-shadow: 0 0 10px rgba(192, 72, 81, 0.4);
}

.category-name {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Promo Banner */
.promo-banner {
    background: linear-gradient(135deg, #4B5563, #1F2937);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.promo-text-content {
    flex: 1;
    z-index: 2;
    padding-right: 15px;
}

.promo-tag {
    font-size: 0.75rem;
    font-weight: bold;
    color: #F97316;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: inline-block;
}

.promo-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 6px;
    line-height: 1.3;
}

.promo-description {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.promo-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    z-index: 2;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    height: calc(70px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--nav-text);
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.75;
    transition: opacity 0.2s, color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    flex: 1;
    padding: 10px 0;
}

.nav-item.active {
    opacity: 1;
    color: var(--nav-active);
}

.nav-item svg {
    margin-bottom: 4px;
    width: 24px;
    height: 24px;
}

/* Product Detail Page */
.detail-image-container {
    width: 100%;
    padding-top: 90%;
    position: relative;
    background-color: var(--bg-darker);
    border-radius: 0 0 20px 20px;
    overflow: hidden;
    margin-top: -20px;
    margin-left: -20px;
    width: calc(100% + 40px);
}

.detail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info-box {
    margin-top: 20px;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.detail-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.detail-section {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.detail-section-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.seller-profile-card {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 12px;
    border-radius: 12px;
    margin-top: 8px;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #B3C1BD;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.seller-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.seller-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.payment-methods-row {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.payment-badge {
    background-color: #FFFFFF;
    color: #333;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.detail-actions-fixed {
    position: absolute;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    z-index: 10;
}

.detail-actions-fixed .btn-secondary {
    flex: 1;
}

.detail-actions-fixed .btn-primary {
    flex: 1;
}

/* Chat Page & Conversation */
.chat-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-radius: 12px;
    background-color: var(--bg-secondary);
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.chat-list-item:hover {
    background-color: var(--card-bg);
}

.chat-item-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0; /* truncate text in flex child */
}

.chat-item-text {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.chat-item-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 10px;
}

/* Chat Room Message View */
.chat-room-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.message-bubble.incoming {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-bubble.outgoing {
    background-color: #555E5C;
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Chat Context Product Card */
.chat-product-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-product-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    background-color: var(--bg-darker);
}

.chat-product-details {
    flex: 1;
}

.chat-product-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.chat-product-name {
    font-size: 0.95rem;
    font-weight: bold;
}

.chat-product-price {
    font-size: 0.9rem;
    font-weight: 500;
}

.chat-input-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--bg-primary);
    z-index: 10;
}

.chat-input {
    flex: 1;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 18px;
    color: var(--text-primary);
    outline: none;
    font-size: 0.95rem;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--accent-red);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Notifications Page */
.notif-section-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.notif-list-item {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    border-left: 4px solid var(--accent-red);
}

.notif-list-item.read {
    border-left-color: transparent;
    opacity: 0.85;
}

.notif-icon-box {
    width: 40px;
    height: 40px;
    background-color: var(--card-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-content-box {
    flex: 1;
}

.notif-title {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.notif-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Profile (Saya) Screen */
.profile-header-card {
    background-color: var(--bg-secondary);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.profile-large-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #E29578;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 12px;
}

.profile-username {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 12px;
}

.profile-info-box {
    margin-bottom: 20px;
}

.profile-info-field {
    margin-bottom: 15px;
}

.profile-info-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: bold;
}

.profile-info-value {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 1rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    border: 1px solid var(--card-border);
}

.profile-info-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* Dashboard layouts (Admin, Seller, Courier) */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border-radius: 14px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: bold;
}

.section-card {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.list-item:last-child {
    border-bottom: none;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-badge.pending_payment { background-color: var(--warning); color: #000; }
.status-badge.pending_shipping { background-color: var(--info); color: #FFF; }
.status-badge.shipped { background-color: #3A86C8; color: #FFF; }
.status-badge.delivered { background-color: var(--success); color: #FFF; }
.status-badge.completed { background-color: #028090; color: #FFF; }
.status-badge.cancelled { background-color: #6C757D; color: #FFF; }
.status-badge.pending_shipping_approval { background-color: #F7B538; color: #000; }
.status-badge.pending_return { background-color: #E29578; color: #FFF; }
.status-badge.returned { background-color: #83C5BE; color: #FFF; }
.status-badge.return_rejected { background-color: var(--accent-red); color: #FFF; }
.status-badge.pending { background-color: #D68C45; color: #FFF; }

.status-badge.role-admin { background-color: var(--accent-red); color: white; }
.status-badge.role-penjual { background-color: var(--info); color: white; }
.status-badge.role-pelanggan { background-color: var(--success); color: white; }
.status-badge.role-kurir { background-color: var(--warning); color: black; }

/* Alert styles */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.alert-success {
    background-color: rgba(82, 183, 136, 0.2);
    border: 1px solid var(--success);
    color: #9BF6FF;
}

.alert-danger {
    background-color: rgba(192, 72, 81, 0.2);
    border: 1px solid var(--accent-red);
    color: #FFADAD;
}
