/* Global Styles */
:root {
    --primary-color: #ff6b35;
    --primary-dark: #e55a2b;
    --secondary-color: #1a1a1a;
    --success-color: #ff6b35;
    --danger-color: #ff4444;
    --warning-color: #ff8c42;
    --info-color: #ff6b35;
    --light-color: #ffffff;
    --dark-color: #000000;
    --gray-100: #ffffff;
    --gray-200: #f5f5f5;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #424242;
    --gray-800: #212121;
    --gray-900: #000000;
    
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    
    --gradient-primary: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    --gradient-success: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    --gradient-danger: linear-gradient(135deg, #ff4444 0%, #cc3333 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    min-height: 100vh;
    color: var(--gray-800);
    overflow-x: hidden;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-container {
    text-align: center;
    color: white;
}

.loading-container h2 {
    font-size: 2.5rem;
    margin: 1rem 0;
    font-weight: 700;
}

.loading-container p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Section Management */
.section {
    display: none !important;
    min-height: 100vh;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.section.active {
    display: block !important;
    opacity: 1;
}

/* Ensure sections don't overlap */
#verification-section {
    position: relative;
    z-index: 2;
}

#dashboard-section {
    position: relative;
    z-index: 1;
}

/* Ensure only one section shows at a time */
#verification-section:not(.active),
#dashboard-section:not(.active) {
    display: none !important;
}

/* Verification Section */
#verification-section {
    display: flex;
    align-items: center;
    justify-content: center;
}

.verification-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    padding: 3rem;
    max-width: 500px;
    width: 100%;
    animation: slideInUp 0.6s ease-out;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.logo-container p {
    color: var(--gray-600);
    font-size: 1.1rem;
}

.verification-step {
    display: none;
}

.verification-step.active {
    display: block;
    animation: fadeInUp 0.5s ease-out;
}

.verification-step h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.verification-step p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Code Input */
.code-input-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.code-digit {
    width: 3rem;
    height: 3rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.code-digit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.code-digit.filled {
    border-color: var(--success-color);
    background-color: rgba(255, 107, 53, 0.1);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    justify-content: center;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    margin-top: 1rem;
    width: 100%;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Timer and Info */
.timer-container {
    text-align: center;
    margin: 1rem 0;
    color: var(--warning-color);
    font-weight: 600;
}

.verification-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 107, 53, 0.1);
    border-radius: var(--border-radius);
    color: var(--primary-color);
}

/* Dashboard Section */
#dashboard-section {
    background: var(--light-color);
    padding: 0;
}

.dashboard-header {
    background: white;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.header-left h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.header-left p {
    color: var(--gray-600);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: var(--gray-600);
    font-weight: 500;
}

/* Navigation */
.dashboard-nav {
    background: white;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--gray-200);
}

.nav-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
}

.nav-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.05);
}

/* Dashboard Content */
.dashboard-content {
    padding: 2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-800);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.header-actions .btn-primary,
.header-actions .btn-success {
    width: auto;
    padding: 0.75rem 1.5rem;
}

/* Filters */
.filters-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.filter-group select,
.search-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-group select:focus,
.search-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-group {
    position: relative;
}

.search-group i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* Staff Grid */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.staff-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.staff-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.staff-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.staff-card-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.staff-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.staff-info p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.tier-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tier-badge.tier-a {
    background: rgba(255, 107, 53, 0.2);
    color: var(--primary-color);
}

.tier-badge.tier-b {
    background: rgba(255, 140, 66, 0.2);
    color: var(--warning-color);
}

.tier-badge.tier-c {
    background: rgba(189, 189, 189, 0.2);
    color: var(--gray-600);
}

.staff-details {
    margin: 1rem 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--gray-600);
    font-weight: 500;
}

.detail-value {
    color: var(--gray-800);
    font-weight: 600;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.employee {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary-color);
}

.status-badge.contractor {
    background: rgba(255, 140, 66, 0.1);
    color: var(--warning-color);
}

.staff-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.staff-actions .btn-secondary,
.staff-actions .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: auto;
}

/* Role Management */
.roles-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.department-roles h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.role-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.role-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.role-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.role-card .japanese-name {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.role-card .description {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.4s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal form {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.form-actions .btn-secondary,
.form-actions .btn-primary {
    width: auto;
    padding: 0.75rem 1.5rem;
}

/* Notifications */
#notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--primary-color);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification i {
    font-size: 1.2rem;
}

.notification .success i {
    color: var(--success-color);
}

.notification .error i {
    color: var(--danger-color);
}

.notification .warning i {
    color: var(--warning-color);
}

.notification .info i {
    color: var(--info-color);
}

.notification-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--gray-800);
}

.notification-content p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .verification-container {
        margin: 1rem;
        padding: 2rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .dashboard-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .filters-container {
        grid-template-columns: 1fr;
    }
    
    .staff-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .content-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    #notification-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .notification {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .code-input-container {
        gap: 0.25rem;
    }
    
    .code-digit {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.2rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Production Management Fields */
.production-fields {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.production-fields .form-group {
    margin-bottom: 1rem;
}

.production-fields label {
    font-weight: 600;
    color: var(--primary-color);
}

/* Roles Management Styles */
.roles-container {
    padding: 2rem 0;
}

.roles-filter-container {
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.filter-group select {
    width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.department-roles {
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s ease-out;
}

.department-roles h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.role-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary-color);
    position: relative;
}

.role-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.role-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.role-card .japanese-name {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.role-card .description {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.role-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.hierarchy-level {
    font-size: 0.8rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.no-roles {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.no-roles i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--gray-400);
}