/**
 * D&D AI RPG - Companion/Party System Styles
 * Party management, companion cards, recruitment, and loyalty display
 */

/* Party Panel Overlay */
.party-panel,
.companion-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.party-content,
.companion-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #3498db;
    border-radius: 15px;
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.party-header,
.companion-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.party-header h2,
.companion-header h2 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.party-header .close-btn,
.companion-header .close-btn {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.party-header .close-btn:hover,
.companion-header .close-btn:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: rotate(90deg);
}

/* Party Stats Bar */
.party-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 20px;
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3);
}

.party-stat {
    text-align: center;
}

.party-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

.party-stat-label {
    font-size: 12px;
    color: #95a5a6;
    text-transform: uppercase;
}

/* Party Tabs */
.party-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 15px 0;
    gap: 5px;
}

.party-tab {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px 8px 0 0;
    color: #95a5a6;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.party-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

.party-tab.active {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

/* Party Body */
.party-body,
.companion-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 180px);
}

/* Current Party Section */
.current-party {
    margin-bottom: 30px;
}

.section-title {
    color: #3498db;
    font-size: 16px;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.party-size {
    font-size: 13px;
    color: #95a5a6;
}

/* Companion Cards Grid */
.party-grid,
.companion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* Companion Card */
.companion-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s;
}

.companion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(52, 152, 219, 0.5);
}

.companion-card.in-party {
    border-color: rgba(46, 204, 113, 0.5);
    background: rgba(46, 204, 113, 0.1);
}

.companion-card-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.companion-portrait {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.companion-info {
    flex: 1;
    min-width: 0;
}

.companion-name {
    font-size: 16px;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 2px;
}

.companion-class {
    font-size: 12px;
    color: #3498db;
    margin-bottom: 4px;
}

.companion-level {
    font-size: 11px;
    color: #95a5a6;
}

/* Loyalty Bar */
.loyalty-container {
    margin-bottom: 10px;
}

.loyalty-label {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.loyalty-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.loyalty-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background-color 0.3s ease;
}

.loyalty-fill.high {
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.loyalty-fill.medium {
    background: linear-gradient(90deg, #f39c12 0%, #f1c40f 100%);
}

.loyalty-fill.low {
    background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
}

/* Companion Stats */
.companion-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.companion-stat {
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 6px;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #ecf0f1;
}

.stat-name {
    font-size: 10px;
    color: #7f8c8d;
    text-transform: uppercase;
}

/* Health/Mana Bars */
.companion-bars {
    margin-bottom: 10px;
}

.resource-bar {
    margin-bottom: 6px;
}

.resource-bar-label {
    font-size: 10px;
    color: #95a5a6;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

.resource-bar-track {
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.resource-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.resource-bar-fill.health {
    background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
}

.resource-bar-fill.mana {
    background: linear-gradient(90deg, #2980b9 0%, #3498db 100%);
}

/* Companion Abilities */
.companion-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.ability-tag {
    font-size: 10px;
    padding: 3px 8px;
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border-radius: 4px;
}

/* Companion Actions */
.companion-actions {
    display: flex;
    gap: 8px;
}

.companion-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.companion-btn.primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
}

.companion-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.companion-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #95a5a6;
}

.companion-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ecf0f1;
}

.companion-btn.danger {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.companion-btn.danger:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* Empty Party Slot */
.empty-slot {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    color: #7f8c8d;
}

.empty-slot-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-slot-text {
    font-size: 14px;
}

/* Recruitment Panel */
.recruitment-section {
    margin-top: 20px;
}

.recruitment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.recruit-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.recruit-card:hover {
    border-color: rgba(52, 152, 219, 0.5);
    background: rgba(52, 152, 219, 0.1);
}

.recruit-card.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.recruit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.recruit-icon {
    font-size: 28px;
}

.recruit-info h4 {
    margin: 0;
    font-size: 14px;
    color: #ecf0f1;
}

.recruit-info p {
    margin: 0;
    font-size: 11px;
    color: #7f8c8d;
}

.recruit-role {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
}

.recruit-cost {
    font-size: 11px;
    color: #f1c40f;
    margin-top: 8px;
}

/* Companion Detail Panel */
.companion-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.companion-detail-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #3498db;
    border-radius: 15px;
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.companion-detail-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.detail-portrait {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.detail-info h3 {
    margin: 0 0 5px 0;
    font-size: 22px;
    color: #fff;
}

.detail-info .detail-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.companion-detail-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    color: #3498db;
    font-size: 14px;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3);
}

.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.detail-stat {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.detail-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #ecf0f1;
}

.detail-stat-name {
    font-size: 11px;
    color: #7f8c8d;
    text-transform: uppercase;
}

.detail-abilities-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-ability {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
}

.detail-ability-name {
    font-weight: bold;
    color: #9b59b6;
    margin-bottom: 3px;
}

.detail-ability-desc {
    font-size: 12px;
    color: #95a5a6;
}

.detail-backstory {
    font-size: 13px;
    color: #bdc3c7;
    line-height: 1.6;
    font-style: italic;
}

.companion-detail-footer {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Companion Notification */
.companion-notification {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.95) 0%, rgba(41, 128, 185, 0.95) 100%);
    border: 3px solid #3498db;
    border-radius: 12px;
    padding: 15px 25px;
    color: #fff;
    z-index: 5000;
    animation: companionNotify 0.5s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(52, 152, 219, 0.4);
}

@keyframes companionNotify {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

.companion-notification.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: all 0.5s ease;
}

.companion-notification .notify-icon {
    font-size: 28px;
}

.companion-notification .notify-text h4 {
    margin: 0 0 3px 0;
    font-size: 15px;
}

.companion-notification .notify-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

/* Party Formation Display (Mini) */
.party-formation-mini {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 10px;
    padding: 10px;
    z-index: 1000;
}

.formation-title {
    font-size: 10px;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.formation-members {
    display: flex;
    gap: 8px;
}

.formation-member {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.formation-member:hover {
    transform: scale(1.1);
    background: rgba(52, 152, 219, 0.3);
}

.formation-member .member-health {
    position: absolute;
    bottom: -2px;
    left: 2px;
    right: 2px;
    height: 3px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.formation-member .member-health-fill {
    height: 100%;
    background: #2ecc71;
    border-radius: 2px;
}

/* Role Colors */
.role-tank { color: #3498db; }
.role-healer { color: #2ecc71; }
.role-dps { color: #e74c3c; }
.role-support { color: #9b59b6; }

.role-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
}

.role-badge.tank {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.role-badge.healer {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.role-badge.dps {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.role-badge.support {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
}

/* Responsive */
@media (max-width: 768px) {
    .party-content,
    .companion-content {
        max-width: 98%;
    }

    .party-grid,
    .companion-grid {
        grid-template-columns: 1fr;
    }

    .recruitment-grid {
        grid-template-columns: 1fr;
    }

    .party-stats {
        flex-wrap: wrap;
        gap: 15px;
    }

    .party-formation-mini {
        bottom: 10px;
        left: 10px;
        padding: 8px;
    }

    .formation-member {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}
