/* ===== BRANCHES PAGE STYLES ===== */

/* Branches Hero Section */
.branches-hero {
    padding: calc(80px + var(--spacing-3xl)) 0 var(--spacing-3xl) 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.branches-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255, 107, 53, 0.08) 0%, transparent 60%);
}

.branch-section {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px);
    transition: none; /* Disable transitions to prevent conflicts */
}

.branch-section.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Force visibility for all content within active sections */
.branch-section.active .department,
.branch-section.active .management-credits,
.branch-section.active .roles-grid,
.branch-section.active .role-card,
/* Force visibility for all content within active sections */
.branch-section.active .department,
.branch-section.active .management-credits,
.branch-section.active .roles-grid,
.branch-section.active .role-card,
.branch-section.active .credits-container {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Preserve grid layouts */
.branch-section.active .roles-grid {
    display: grid !important;
}

.branch-section.active .management-credits {
    display: grid !important;
}

/* Preserve flex layouts */
.branch-section.active .role-card-members {
    display: flex !important;
}

.branch-section.active .featured-credit {
    display: block !important;
}

.branches-hero .hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.branches-hero .hero-title {
    margin-bottom: var(--spacing-lg);
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: white;
    font-weight: 900;
}

.branches-hero .hero-description {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-xl);
    line-height: 1.7;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

.breadcrumbs a {
    color: #ff6b35;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: #ff8c5a;
}

.separator {
    color: rgba(255, 255, 255, 0.4);
}

.current {
    color: white;
    font-weight: var(--font-weight-medium);
}

/* Branch Selection */
.branch-selection {
    padding: var(--spacing-2xl) 0;
    background: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 80px;
    z-index: var(--z-sticky);
    backdrop-filter: blur(10px);
}

.branch-tabs {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.branch-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) var(--spacing-xl);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    max-width: 280px;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex: 1;
}

.branch-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 107, 53, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.branch-tab:hover {
    border-color: #ff6b35;
    color: #ff6b35;
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(255, 107, 53, 0.15);
}

.branch-tab:hover::before {
    opacity: 1;
}

.branch-tab.active {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
    border-color: #ff6b35;
    color: white;
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(255, 107, 53, 0.3);
}

.branch-tab.active::before {
    display: none;
}

.branch-tab i {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.branch-tab span {
    font-size: 1rem;
    font-weight: 700;
}

.tier-price {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 4px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

.branch-tab:not(.active) .tier-price {
    background: rgba(255, 107, 53, 0.1);
    color: #ff6b35;
}

/* Team Structure */
.team-structure {
    padding: var(--spacing-3xl) 0;
    background: #0a0a0a;
    min-height: 80vh;
}

.branch-section {
    animation: fadeInUp 0.6s ease-out;
    display: none;
}

.branch-section.active {
    display: block;
}

.branch-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.branch-header h2 {
    color: white;
    margin-bottom: var(--spacing-md);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
}

.branch-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.125rem;
    line-height: 1.6;
}

/* Credits Container */
.credits-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-2xl);
    padding: 0 var(--spacing-lg);
}

/* Department Styling */
.department {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: var(--spacing-xl);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.department:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateY(-4px);
}

.department::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b35 0%, #ff8c5a 100%);
}

.department h3 {
    color: white;
    margin-bottom: var(--spacing-lg);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.department h3 i {
    color: #ff6b35;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Credits Style Layout */
.credits-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.credit-group {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.credit-group:hover {
    background: rgba(255, 107, 53, 0.05);
    margin: 0 calc(-1 * var(--spacing-md));
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    border-radius: 8px;
}

.credit-group:last-child {
    border-bottom: none;
}

.credit-role {
    font-weight: 600;
    color: #ff6b35;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 140px;
    flex-shrink: 0;
}

.credit-names {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: right;
    flex: 1;
}

/* Management Credits (Featured) */
.management-credits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.featured-credit {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 12px;
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.3s ease;
}

.featured-credit:hover {
    background: rgba(255, 107, 53, 0.15);
    transform: translateY(-2px);
}

.featured-role {
    font-weight: 700;
    color: #ff6b35;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
}

.featured-name {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.featured-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Compact Department List */
.department-compact {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.department-compact h4 {
    color: #ff6b35;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.department-compact h4 i {
    font-size: 0.9rem;
}

/* Role Cards - Individual card style for each role */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.role-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05) 0%, rgba(255, 165, 0, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.role-card:hover::before {
    opacity: 1;
}

.role-card:hover {
    background: rgba(255, 107, 53, 0.08);
    border-color: var(--primary-orange);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.15);
}

.role-card-title {
    color: var(--primary-orange);
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 1;
    line-height: 1.3;
}

.role-card-title .japanese {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
    margin-top: 4px;
    text-transform: none;
}

.role-card-members {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    line-height: 1.6;
    position: relative;
    z-index: 1;
    font-size: 1rem;
}

.role-card-members .member {
    display: block;
    margin-bottom: 4px;
    padding: 2px 0;
}

.role-card-members .member:last-child {
    margin-bottom: 0;
}

/* Hide old credit group styling when using cards */
.use-cards .credits-section {
    display: none;
}

.use-cards .credit-group {
    display: none;
}

/* Enhanced Executive Cards */
.executive-card .executive-role .japanese {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
    text-transform: none;
}

/* Alternative Credits Grid Layout */
.credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.credits-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: var(--spacing-lg);
    transition: all 0.3s ease;
}

.credits-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #ff6b35;
}

.credits-role {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: var(--spacing-xs);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: var(--spacing-xs);
}

.credits-names {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Clean list style for departments */
.department-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.department-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.department-item:hover {
    border-color: #ff6b35;
    transform: translateX(4px);
}

.department-role {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
}

.department-members {
    color: #64748b;
    font-size: 0.9rem;
    text-align: right;
    flex: 1;
    margin-left: var(--spacing-lg);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Loading animation for branch switching */
.branch-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.branch-section.active {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .branches-hero {
        padding: calc(80px + var(--spacing-xl)) 0 var(--spacing-xl) 0;
    }
    
    .branches-hero .hero-title {
        font-size: 2.5rem;
    }
    
    .branch-tabs {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-sm);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 var(--spacing-md);
    }
    
    .branch-tab {
        min-width: 160px;
        max-width: 180px;
        flex-shrink: 0;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .credits-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .department {
        padding: var(--spacing-lg);
    }
    
    .management-credits {
        grid-template-columns: 1fr;
    }
    
    .credit-group {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
    
    .credit-role {
        min-width: unset;
    }
    
    .credit-names {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .branch-tab {
        padding: var(--spacing-lg);
        min-width: 200px;
    }
    
    .department h3 {
        font-size: 1.1rem;
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xs);
    }
    
    .featured-credit {
        padding: var(--spacing-md);
    }
    
    .credit-group:hover {
        margin: 0;
        padding: var(--spacing-md) 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .branch-selection {
        background: #1a1a2e;
        border-bottom-color: #2d2d44;
    }
    
    .branch-tab {
        background: #2d2d44;
        border-color: #3d3d5c;
        color: #e2e8f0;
    }
    
    .branch-tab:hover {
        border-color: #ff6b35;
        color: #ff6b35;
    }
    
    .team-structure {
        background: linear-gradient(to bottom, #1a1a2e 0%, #16213e 100%);
    }
    
    .department {
        background: #2d2d44;
        border-color: #3d3d5c;
    }
    
    .branch-header h2 {
        color: white;
    }
    
    .branch-header p {
        color: #cbd5e1;
    }
    
    .department h3 {
        color: white;
    }
    
    .role-card {
        background: #3d3d5c;
        border-color: #4d4d6c;
        color: #e2e8f0;
    }
    
    .role-title {
        color: white;
    }
    
    .member-name {
        color: #cbd5e1;
    }
    
    .team-grid .role-card {
        background: #3d3d5c;
        border-color: #4d4d6c;
    }
}

/* ===== ADMIN INTERFACE STYLES ===== */
.admin-gear-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.admin-gear-button:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.admin-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.admin-modal-content {
    background: #3a4552;
    margin: 15% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    border: none;
}

.admin-modal-header {
    background: #3a4552;
    color: #ff6b35;
    padding: 2rem 2rem 1rem 2rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

.admin-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ff6b35;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-close {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    color: #888;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: none;
}

.admin-section {
    padding: 0 2rem 2rem 2rem;
    color: #e2e8f0;
}

.admin-form-group {
    margin-bottom: 1.5rem;
}

.admin-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e2e8f0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-form-group input,
.admin-form-group select {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: #2a3138;
    color: #e2e8f0;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.admin-form-group input:focus,
.admin-form-group select:focus {
    outline: none;
    background: #1f252b;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.admin-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-btn-primary {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1rem;
}

.admin-btn-success {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.admin-btn-warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.admin-btn-danger {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
}

.admin-btn-info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.admin-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 0.3rem;
    transition: all 0.3s ease;
}

.admin-controls {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.admin-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.role-editor {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 107, 53, 0.2);
    max-height: 400px;
    overflow-y: auto;
}

.admin-role-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.admin-role-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.admin-role-actions {
    display: flex;
    gap: 0.3rem;
}

.admin-members {
    color: #a0aec0;
    font-size: 0.9rem;
}

/* Responsive admin styles */
@media (max-width: 768px) {
    .admin-modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 95vh;
    }
    
    .admin-section {
        padding: 1rem;
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-btn {
        width: 100%;
        justify-content: center;
        margin-right: 0;
    }
    
    .admin-gear-button {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 1rem;
    }
}
