/* Benefits Manager Specific Styles */

.benefits-main {
    margin-top: 100px;
    min-height: 100vh;
    background-color: var(--neutral-light);
}

.benefits-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 60px 0;
    color: var(--white);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.benefits-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 30px;
    opacity: 0.95;
}

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary-outline {
    background-color: transparent;
    color: var(--white);
    padding: 14px 28px;
    border: 2px solid var(--white);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
}

.btn-secondary-outline:hover {
    background-color: var(--white);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Branches Section */
.branches-section {
    padding: 120px 0;
}

.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Branch Card */
.branch-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.branch-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.branch-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.branch-header:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.branch-header.active {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
}

.branch-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.branch-icon svg {
    width: 28px;
    height: 28px;
    color: var(--white);
}

.branch-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
    margin: 0;
}

.expand-btn {
    width: 35px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.expand-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.expand-btn svg {
    width: 20px;
    height: 20px;
    color: var(--white);
    transition: transform 0.3s ease;
}

.branch-header.active .expand-btn svg {
    transform: rotate(180deg);
}

/* Branch Content */
.branch-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.branch-content.active {
    max-height: 10000px;
    padding: 20px;
}

/* Categories Accordion */
.categories-accordion {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-item {
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 2px solid transparent;
    transition: var(--transition);
}

.category-item:hover {
    border-color: var(--primary-light);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    cursor: pointer;
    background-color: var(--white);
    transition: var(--transition);
}

.category-header:hover {
    background-color: var(--gray-light);
}

.category-header.active {
    background-color: var(--primary-light);
    color: var(--white);
}

.category-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.category-header.active .category-number {
    background: var(--white);
    color: var(--primary-color);
}

.category-title {
    flex: 1;
    margin: 0 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.category-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.category-header.active .category-toggle svg {
    transform: rotate(180deg);
}

/* Category Content */
.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.category-content.active {
    max-height: 2000px;
}

.category-form {
    padding: 20px;
    background-color: var(--white);
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid var(--gray-medium);
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
    background-color: var(--white);
    direction: rtl;
}

.form-textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 123, 160, 0.1);
}

.form-textarea::placeholder {
    color: var(--neutral-medium);
    opacity: 0.6;
}

.category-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.btn-save-category {
    background-color: var(--success);
    color: var(--white);
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
}

.btn-save-category:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-clear-category {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
}

.btn-clear-category:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Character Count */
.char-count {
    text-align: left;
    font-size: 0.85rem;
    color: var(--neutral-medium);
    margin-top: 5px;
    direction: ltr;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--success);
    color: var(--white);
    padding: 18px 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 2000;
    font-weight: 600;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--neutral-medium);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Loading State */
.loading-spinner {
    border: 3px solid rgba(36, 123, 160, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Indicator */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-saved {
    background-color: var(--success);
}

.status-unsaved {
    background-color: var(--accent-color);
}

.status-empty {
    background-color: var(--neutral-medium);
}

/* Responsive Design */
@media (max-width: 768px) {
    .benefits-hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions button {
        width: 100%;
    }

    .branches-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .branch-header {
        padding: 20px 15px;
    }

    .branch-header h2 {
        font-size: 1.2rem;
    }

    .branch-icon {
        width: 40px;
        height: 40px;
    }

    .branch-icon svg {
        width: 22px;
        height: 22px;
    }

    .category-header {
        padding: 15px;
        flex-wrap: wrap;
    }

    .category-title {
        font-size: 1rem;
        margin: 0 10px;
    }

    .form-textarea {
        min-height: 150px;
        font-size: 0.95rem;
    }

    .category-actions {
        flex-direction: column;
    }

    .category-actions button {
        width: 100%;
    }

    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .benefits-main {
        margin-top: 80px;
    }

    .benefits-hero {
        padding: 40px 0;
    }

    .benefits-hero h1 {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .branches-section {
        padding: 40px 0;
    }

    .branch-header h2 {
        font-size: 1.1rem;
    }

    .category-title {
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    .main-nav,
    .hero-actions,
    .category-actions,
    .toast,
    .main-footer {
        display: none;
    }

    .benefits-hero {
        background: var(--white);
        color: var(--primary-color);
        padding: 20px 0;
    }

    .branch-card {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .branch-content {
        max-height: none !important;
        padding: 20px !important;
    }

    .category-content {
        max-height: none !important;
    }

    .form-textarea {
        border: 1px solid #ddd;
        min-height: auto;
    }
}

/* Accessibility Improvements */
.branch-header:focus,
.category-header:focus,
.expand-btn:focus,
.category-toggle:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--white);
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    bottom: 80px;
    right: 30px;
    background-color: var(--white);
    padding: 12px 18px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    z-index: 1999;
}

.connection-status.online {
    border-right: 3px solid var(--success);
}

.connection-status.offline {
    border-right: 3px solid var(--secondary-color);
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
    animation: pulse 2s infinite;
}

.connection-status.offline .connection-dot {
    background-color: var(--secondary-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Error Message */
.error-message-box {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: var(--border-radius);
    color: #842029;
    padding: 15px 20px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-message-box svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.warning-message-box {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: var(--border-radius);
    color: #664d03;
    padding: 15px 20px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-message-box {
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
    border-radius: var(--border-radius);
    color: #0f5132;
    padding: 15px 20px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Login Modal */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.login-modal.active {
    display: flex;
}

.login-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.login-modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    z-index: 1;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 35px;
    height: 35px;
    background-color: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--neutral-dark);
}

.close-modal:hover {
    background-color: var(--secondary-color);
    color: var(--white);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.modal-header p {
    color: var(--neutral-medium);
    font-size: 1rem;
}

.login-modal .error-message {
    background-color: #f8d7da;
    color: #842029;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.login-modal .error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.login-modal .form-group {
    margin-bottom: 20px;
}

.login-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.login-modal .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-medium);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: var(--transition);
}

.login-modal .form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 123, 160, 0.1);
}

.btn-modal-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
}

.btn-modal-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(36, 123, 160, 0.3);
}

.btn-modal-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-info {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-medium);
    color: var(--neutral-medium);
    font-size: 0.9rem;
}

/* Read-Only Mode */
.form-textarea:read-only {
    background-color: var(--gray-light);
    cursor: default;
    border-color: var(--gray-medium);
}

.category-actions.read-only {
    display: none;
}

.btn-edit-mode {
    background-color: var(--accent-color);
    color: var(--neutral-dark);
    padding: 8px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
    margin-top: 10px;
}

.btn-edit-mode:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
}

.btn-edit-mode svg {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.edit-mode-indicator {
    display: inline-block;
    background-color: var(--success);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 10px;
}

.logout-btn {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--white);
    padding: 8px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-main);
    margin-right: 10px;
}

.logout-btn:hover {
    background-color: var(--white);
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.branch-card {
    animation: fadeIn 0.5s ease forwards;
}

.branch-card:nth-child(1) { animation-delay: 0.1s; }
.branch-card:nth-child(2) { animation-delay: 0.2s; }
.branch-card:nth-child(3) { animation-delay: 0.3s; }
.branch-card:nth-child(4) { animation-delay: 0.4s; }
.branch-card:nth-child(5) { animation-delay: 0.5s; }
.branch-card:nth-child(6) { animation-delay: 0.6s; }
.branch-card:nth-child(7) { animation-delay: 0.7s; }
.branch-card:nth-child(8) { animation-delay: 0.8s; }

