/* commun.ititti.es - P2P Grocery Cooperatives Style Sheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: radial-gradient(circle at 20% 30%, #1e1b29 0%, #0c0a0f 100%);
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    padding: 2.5rem 2.5rem 1rem 2.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff9f43 0%, #ff5252 50%, #70a1ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

header h1 span {
    font-weight: 400;
    opacity: 0.8;
}

header p {
    color: #a0aec0;
    font-size: 1.1rem;
    margin-top: 0.3rem;
}

/* Main workspace */
main {
    flex: 1;
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 2.5rem 3rem 2.5rem;
    gap: 2.5rem;
}

.workspace-left {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workspace-right {
    flex: 0.8;
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.workspace-right img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Glassmorphism Panels */
.glass-panel {
    background: rgba(30, 27, 45, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Navigation Tabs */
.tabs-navigation {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
    margin-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    color: #718096;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ff9f43;
    background: rgba(255, 159, 67, 0.12);
    box-shadow: inset 0 0 10px rgba(255, 159, 67, 0.1);
}

/* Tab contents */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tab 1: P2P Cooperative Calculator Styles */
.coop-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.delivery-thresholds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.threshold-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-store {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.card-store.walmart { color: #2e86de; }
.card-store.target { color: #ff5252; }

.price-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 0.6rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.walmart .progress-fill { background: #2e86de; }
.target .progress-fill { background: #ff5252; }

.threshold-text {
    font-size: 0.85rem;
    color: #a0aec0;
}

/* User Selection & Shopping Panels */
.partner-lists-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.partner-box {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.partner-box h3 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
}

.partner-role {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    color: #cbd5e0;
}

.grocery-list-items {
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.3rem;
}

.grocery-item-row {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 0.95rem;
}

.item-origin {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.origin-w { background: rgba(46, 134, 222, 0.15); color: #2e86de; }
.origin-t { background: rgba(255, 82, 82, 0.15); color: #ff5252; }

.remove-item-btn {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 1rem;
    margin-left: 0.5rem;
}

.add-item-controls {
    display: flex;
    gap: 0.5rem;
}

select.item-selector {
    flex: 1;
    background: #1a1625;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    outline: none;
    font-size: 0.9rem;
}

.add-btn {
    background: #ff9f43;
    border: none;
    color: #0c0a0f;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.add-btn:hover {
    background: #ffb85f;
}

/* Swap & Settle Calculations Section */
.swap-settle-card {
    background: linear-gradient(135deg, rgba(255, 159, 67, 0.08) 0%, rgba(255, 82, 82, 0.08) 100%);
    border: 1px solid rgba(255, 159, 67, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.swap-settle-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ff9f43;
    display: flex;
    justify-content: space-between;
}

.swap-directions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-size: 0.95rem;
}

.swap-direction-row {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    border-left: 4px solid #ff9f43;
}

.swap-direction-row strong {
    color: #fff;
}

.settlement-result-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.settlement-balance {
    font-size: 1.1rem;
    font-weight: 500;
}

.settlement-balance span {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1dd1a1;
}

.settle-action-btn {
    background: #1dd1a1;
    border: none;
    color: #0c0a0f;
    font-weight: 700;
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.settle-action-btn:hover {
    background: #10ac84;
    transform: scale(1.03);
}

.settle-action-btn.disabled {
    background: rgba(255, 255, 255, 0.08);
    color: #718096;
    cursor: not-allowed;
    transform: none;
}

/* Tab 2: SSO Identity Hub Styles */
.sso-hub-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sso-badge-profile {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sso-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff9f43, #ff5252);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: #0c0a0f;
}

.sso-user-info h4 {
    font-size: 1.3rem;
    font-weight: 700;
}

.sso-user-info p {
    font-size: 0.9rem;
    color: #a0aec0;
}

.sso-status-badge {
    background: rgba(29, 209, 161, 0.15);
    color: #1dd1a1;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
    margin-top: 0.2rem;
}

.sso-integrations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.integration-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.integration-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

.integration-name {
    font-weight: 600;
}

.integration-domain {
    font-size: 0.8rem;
    color: #718096;
}

.session-toggle-btn {
    background: #ff5252;
    border: none;
    color: #fff;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s ease;
}

.session-toggle-btn.inactive {
    background: #2e86de;
}

/* Tab 3: Coop Messaging Center Styles */
.messaging-container {
    display: flex;
    flex-direction: column;
    height: 480px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.chat-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-partner-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.partner-status-dot {
    width: 8px;
    height: 8px;
    background: #1dd1a1;
    border-radius: 50%;
}

.chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-msg {
    max-width: 70%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.chat-msg.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.chat-msg.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #ff9f43 0%, #ff5252 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.2);
}

.chat-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 0.3rem;
    text-align: right;
}

.chat-input-area {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.8rem;
}

.chat-input-area input {
    flex: 1;
    background: #1a1625;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    outline: none;
}

.chat-send-btn {
    background: #ff9f43;
    border: none;
    color: #0c0a0f;
    font-weight: 700;
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-send-btn:hover {
    background: #ffb85f;
}

/* Footer & Support */
footer {
    padding: 2rem;
    text-align: center;
    color: #4a5568;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: auto;
}

footer a {
    color: #a0aec0;
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #ff9f43;
}

/* Responsive constraints */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
        padding: 1rem 1.5rem;
    }
    .workspace-right {
        display: none; /* Hide illustrative sidebar on small screens to prioritize calculator */
    }
    .partner-lists-container {
        grid-template-columns: 1fr;
    }
    .delivery-thresholds {
        grid-template-columns: 1fr;
    }
}
