.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 62, 80, 0.8);
    overflow: auto;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: #fff;
    margin: 3% auto;
    padding: 35px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid #3498db;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 600;
}

.close-btn {
    font-size: 32px;
    font-weight: bold;
    color: #95a5a6;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    color: #e74c3c;
    background-color: #f8f9fa;
    transform: rotate(90deg);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
    font-size: 15px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 2px solid #ecf0f1;
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    position: relative;
    top: 2px;
}

.tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background-color: rgba(52, 152, 219, 0.05);
}

.tab:hover:not(.active) {
    color: #34495e;
    background-color: #f8f9fa;
}

.tab-content {
    display: none;
    animation: fadeInContent 0.3s ease;
}

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

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

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 5px;
}

.friend-item, .team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background-color: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.friend-item:hover, .team-item:hover {
    background-color: #ecf0f1;
    border-left-color: #3498db;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.friend-info, .team-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.friend-name, .team-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

.friend-email, .team-members {
    font-size: 13px;
    color: #7f8c8d;
}

.access-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.access-badge.editor {
    background-color: #2ecc71;
    color: white;
}

.access-badge.viewer {
    background-color: #3498db;
    color: white;
}

.friend-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-add, .btn-toggle, .btn-remove {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add {
    background-color: #2ecc71;
    color: white;
}

.btn-add:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
}

.btn-toggle {
    background-color: #f39c12;
    color: white;
}

.btn-toggle:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.btn-remove {
    background-color: #e74c3c;
    color: white;
}

.btn-remove:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.modal-footer {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 2px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-save, .btn-cancel {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
}

.btn-save {
    background-color: #2ecc71;
    color: white;
}

.btn-save:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-cancel {
    background-color: #95a5a6;
    color: white;
}

.btn-cancel:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.no-items {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-style: italic;
    font-size: 15px;
}

.message {
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #2ecc71;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #e74c3c;
}

.section-divider {
    height: 2px;
    background: linear-gradient(to right, #3498db, transparent);
    margin: 30px 0;
}

@media(max-width: 768px) {
    .modal-content {
        margin: 5% 10px;
        padding: 25px 20px;
        width: calc(100% - 20px);
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1;
        min-width: 100px;
        font-size: 13px;
        padding: 10px 15px;
    }

    .friend-item, .team-item {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .friend-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn-add, .btn-toggle, .btn-remove {
        flex: 1;
        min-width: 100px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn-save, .btn-cancel {
        width: 100%;
    }
}